generated/api/CommvaultPowerShell.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 { using static Commvault.Powershell.Runtime.Extensions; /// <summary> /// Low-level API implementation for the CommvaultPowerShell service. /// Commvault APIs /// </summary> public partial class CommvaultPowerShell { /// <summary>API to deploy Access Node</summary> /// <param name="body">AccessNodeDeployment</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AccessNode(Commvault.Powershell.Models.IAccessNodeDeployment body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AccessNode" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AccessNode_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>API to deploy Access Node</summary> /// <param name="body">AccessNodeDeployment</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup> AccessNodeWithResult(Commvault.Powershell.Models.IAccessNodeDeployment body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AccessNode" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AccessNodeWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "AccessNodeWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup> AccessNodeWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "AccessNode" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AccessNode_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="AccessNode" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="body">AccessNodeDeployment</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AccessNode_Validate(Commvault.Powershell.Models.IAccessNodeDeployment body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Add content to Dynamics 365 app</summary> /// <param name="appId">Commvault dynamics 365 app id</param> /// <param name="body">Request Message to add content to dynamics 365 app</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddD365Content(long appId, Commvault.Powershell.Models.IDynamics365ContentReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Dynamics365/" + (appId.ToString()) + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddD365Content_Call (request, onOk,eventListener,sender); } } /// <summary>Add content to Dynamics 365 app</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Message to add content to dynamics 365 app</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddD365ContentViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IDynamics365ContentReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Dynamics365/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Dynamics365/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Dynamics365/" + appId + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddD365Content_Call (request, onOk,eventListener,sender); } } /// <summary>Add content to Dynamics 365 app</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Message to add content to dynamics 365 app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddD365ContentViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IDynamics365ContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Dynamics365/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Dynamics365/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Dynamics365/" + appId + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddD365ContentWithResult_Call (request, eventListener,sender); } } /// <summary>Add content to Dynamics 365 app</summary> /// <param name="appId">Commvault dynamics 365 app id</param> /// <param name="body">Request Message to add content to dynamics 365 app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddD365ContentWithResult(long appId, Commvault.Powershell.Models.IDynamics365ContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Dynamics365/" + (appId.ToString()) + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddD365ContentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "AddD365ContentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddD365ContentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "AddD365Content" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddD365Content_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="AddD365Content" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="appId">Commvault dynamics 365 app id</param> /// <param name="body">Request Message to add content to dynamics 365 app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddD365Content_Validate(long appId, Commvault.Powershell.Models.IDynamics365ContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Add Content to Office 365 Exchange Online app</summary> /// <param name="appId">Commvault exchange app id</param> /// <param name="body">Request Message to add content to exchange app</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddExchangeContent(long appId, Commvault.Powershell.Models.IExchangeContentReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange/" + (appId.ToString()) + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddExchangeContent_Call (request, onOk,eventListener,sender); } } /// <summary>Add Content to Office 365 Exchange Online app</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Message to add content to exchange app</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddExchangeContentViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IExchangeContentReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Exchange/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Exchange/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange/" + appId + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddExchangeContent_Call (request, onOk,eventListener,sender); } } /// <summary>Add Content to Office 365 Exchange Online app</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Message to add content to exchange app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddExchangeContentViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IExchangeContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Exchange/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Exchange/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange/" + appId + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddExchangeContentWithResult_Call (request, eventListener,sender); } } /// <summary>Add Content to Office 365 Exchange Online app</summary> /// <param name="appId">Commvault exchange app id</param> /// <param name="body">Request Message to add content to exchange app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddExchangeContentWithResult(long appId, Commvault.Powershell.Models.IExchangeContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange/" + (appId.ToString()) + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddExchangeContentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "AddExchangeContentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddExchangeContentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "AddExchangeContent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddExchangeContent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="AddExchangeContent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="appId">Commvault exchange app id</param> /// <param name="body">Request Message to add content to exchange app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddExchangeContent_Validate(long appId, Commvault.Powershell.Models.IExchangeContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to add a media agent to a local storage pool access path</summary> /// <param name="storagePoolId">Id of the local storage pool whose details have to be fetched to add a new access path</param> /// <param name="backupLocationId">Id of the backup location whose details have to be fetched to add a new access path</param> /// <param name="body">Used to add a new access path to a backup location</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddLocalAccessPath(long storagePoolId, long backupLocationId, Commvault.Powershell.Models.IAddLocalAccessPath body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddLocalAccessPath_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to add a media agent to a local storage pool access path</summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to add a new access path to a backup location</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddLocalAccessPathViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IAddLocalAccessPath body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddLocalAccessPath_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to add a media agent to a local storage pool access path</summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to add a new access path to a backup location</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddLocalAccessPathViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IAddLocalAccessPath body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddLocalAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary>Used to add a media agent to a local storage pool access path</summary> /// <param name="storagePoolId">Id of the local storage pool whose details have to be fetched to add a new access path</param> /// <param name="backupLocationId">Id of the backup location whose details have to be fetched to add a new access path</param> /// <param name="body">Used to add a new access path to a backup location</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddLocalAccessPathWithResult(long storagePoolId, long backupLocationId, Commvault.Powershell.Models.IAddLocalAccessPath body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddLocalAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "AddLocalAccessPathWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddLocalAccessPathWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "AddLocalAccessPath" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddLocalAccessPath_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="AddLocalAccessPath" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the local storage pool whose details have to be fetched to add a new access path</param> /// <param name="backupLocationId">Id of the backup location whose details have to be fetched to add a new access path</param> /// <param name="body">Used to add a new access path to a backup location</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddLocalAccessPath_Validate(long storagePoolId, long backupLocationId, Commvault.Powershell.Models.IAddLocalAccessPath body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to add a media agent to a disk access path</summary> /// <param name="storagePoolId">Id of the disk storage pool whose details have to be fetched to add a new access path</param> /// <param name="backupLocationId">Id of the backup location whose details have to be fetched to add a new access path</param> /// <param name="body">Used to add a new access path to a backup location</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddMediaAgent(long storagePoolId, long backupLocationId, Commvault.Powershell.Models.IAddDiskAccessPath body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddMediaAgent_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Put call to consume ma license for a client</summary> /// <param name="serverId">serverId of the client for which the MA role needs to be added</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddMediaAgentRole(long serverId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Servers/" + (serverId.ToString()) + "/Role/MediaAgent" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddMediaAgentRole_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Put call to consume ma license for a client</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddMediaAgentRoleViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Servers/(?<serverId>[^/]+)/Role/MediaAgent$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Servers/{serverId}/Role/MediaAgent'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Servers/" + serverId + "/Role/MediaAgent" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddMediaAgentRole_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Put call to consume ma license for a client</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddMediaAgentRoleViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Servers/(?<serverId>[^/]+)/Role/MediaAgent$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Servers/{serverId}/Role/MediaAgent'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Servers/" + serverId + "/Role/MediaAgent" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddMediaAgentRoleWithResult_Call (request, eventListener,sender); } } /// <summary>Put call to consume ma license for a client</summary> /// <param name="serverId">serverId of the client for which the MA role needs to be added</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddMediaAgentRoleWithResult(long serverId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Servers/" + (serverId.ToString()) + "/Role/MediaAgent" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddMediaAgentRoleWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "AddMediaAgentRoleWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddMediaAgentRoleWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "AddMediaAgentRole" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddMediaAgentRole_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="AddMediaAgentRole" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="serverId">serverId of the client for which the MA role needs to be added</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddMediaAgentRole_Validate(long serverId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to add a media agent to a disk access path</summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to add a new access path to a backup location</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddMediaAgentViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IAddDiskAccessPath body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddMediaAgent_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to add a media agent to a disk access path</summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to add a new access path to a backup location</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddMediaAgentViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IAddDiskAccessPath body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddMediaAgentWithResult_Call (request, eventListener,sender); } } /// <summary>Used to add a media agent to a disk access path</summary> /// <param name="storagePoolId">Id of the disk storage pool whose details have to be fetched to add a new access path</param> /// <param name="backupLocationId">Id of the backup location whose details have to be fetched to add a new access path</param> /// <param name="body">Used to add a new access path to a backup location</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddMediaAgentWithResult(long storagePoolId, long backupLocationId, Commvault.Powershell.Models.IAddDiskAccessPath body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddMediaAgentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "AddMediaAgentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddMediaAgentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "AddMediaAgent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddMediaAgent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="AddMediaAgent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the disk storage pool whose details have to be fetched to add a new access path</param> /// <param name="backupLocationId">Id of the backup location whose details have to be fetched to add a new access path</param> /// <param name="body">Used to add a new access path to a backup location</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddMediaAgent_Validate(long storagePoolId, long backupLocationId, Commvault.Powershell.Models.IAddDiskAccessPath body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Add content to Office 365 OneDrive for Business app</summary> /// <param name="appId">Commvault onedrive app id</param> /// <param name="body">Request Message to add content to onedrive app</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddOnedriveContent(long appId, Commvault.Powershell.Models.IOnedriveContentReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/OneDrive/" + (appId.ToString()) + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddOnedriveContent_Call (request, onOk,eventListener,sender); } } /// <summary>Add content to Office 365 OneDrive for Business app</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Message to add content to onedrive app</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddOnedriveContentViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IOnedriveContentReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/OneDrive/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/OneDrive/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/OneDrive/" + appId + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddOnedriveContent_Call (request, onOk,eventListener,sender); } } /// <summary>Add content to Office 365 OneDrive for Business app</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Message to add content to onedrive app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddOnedriveContentViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IOnedriveContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/OneDrive/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/OneDrive/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/OneDrive/" + appId + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddOnedriveContentWithResult_Call (request, eventListener,sender); } } /// <summary>Add content to Office 365 OneDrive for Business app</summary> /// <param name="appId">Commvault onedrive app id</param> /// <param name="body">Request Message to add content to onedrive app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddOnedriveContentWithResult(long appId, Commvault.Powershell.Models.IOnedriveContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/OneDrive/" + (appId.ToString()) + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddOnedriveContentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "AddOnedriveContentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddOnedriveContentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "AddOnedriveContent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddOnedriveContent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="AddOnedriveContent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="appId">Commvault onedrive app id</param> /// <param name="body">Request Message to add content to onedrive app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddOnedriveContent_Validate(long appId, Commvault.Powershell.Models.IOnedriveContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Add content to Office 365 SharePoint Online app</summary> /// <param name="appId">Commvault sharepoint app id</param> /// <param name="body">Request Message to add content to sharepoint app</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddSharepointContent(long appId, Commvault.Powershell.Models.ISharepointContentReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/SharePoint/" + (appId.ToString()) + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddSharepointContent_Call (request, onOk,eventListener,sender); } } /// <summary>Add content to Office 365 SharePoint Online app</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Message to add content to sharepoint app</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddSharepointContentViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ISharepointContentReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/SharePoint/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/SharePoint/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/SharePoint/" + appId + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddSharepointContent_Call (request, onOk,eventListener,sender); } } /// <summary>Add content to Office 365 SharePoint Online app</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Message to add content to sharepoint app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddSharepointContentViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ISharepointContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/SharePoint/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/SharePoint/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/SharePoint/" + appId + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddSharepointContentWithResult_Call (request, eventListener,sender); } } /// <summary>Add content to Office 365 SharePoint Online app</summary> /// <param name="appId">Commvault sharepoint app id</param> /// <param name="body">Request Message to add content to sharepoint app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddSharepointContentWithResult(long appId, Commvault.Powershell.Models.ISharepointContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/SharePoint/" + (appId.ToString()) + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddSharepointContentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "AddSharepointContentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddSharepointContentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "AddSharepointContent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddSharepointContent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="AddSharepointContent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="appId">Commvault sharepoint app id</param> /// <param name="body">Request Message to add content to sharepoint app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddSharepointContent_Validate(long appId, Commvault.Powershell.Models.ISharepointContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Add a new software cache</summary> /// <param name="body">Details of software cache server.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddSoftwareCache(Commvault.Powershell.Models.ISoftwareCacheDetail body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SoftwareCache" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddSoftwareCache_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Add a new software cache</summary> /// <param name="body">Details of software cache server.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddSoftwareCacheWithResult(Commvault.Powershell.Models.ISoftwareCacheDetail body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SoftwareCache" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddSoftwareCacheWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "AddSoftwareCacheWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddSoftwareCacheWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "AddSoftwareCache" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddSoftwareCache_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="AddSoftwareCache" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Details of software cache server.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddSoftwareCache_Validate(Commvault.Powershell.Models.ISoftwareCacheDetail body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Add content to Office 365 Teams app</summary> /// <param name="appId">Commvault teams app id</param> /// <param name="body">Request Message to add content to teams app</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddTeamsContent(long appId, Commvault.Powershell.Models.ITeamsContentReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams/" + (appId.ToString()) + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddTeamsContent_Call (request, onOk,eventListener,sender); } } /// <summary>Add content to Office 365 Teams app</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Message to add content to teams app</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AddTeamsContentViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ITeamsContentReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Teams/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Teams/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams/" + appId + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AddTeamsContent_Call (request, onOk,eventListener,sender); } } /// <summary>Add content to Office 365 Teams app</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Message to add content to teams app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddTeamsContentViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ITeamsContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Teams/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Teams/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams/" + appId + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddTeamsContentWithResult_Call (request, eventListener,sender); } } /// <summary>Add content to Office 365 Teams app</summary> /// <param name="appId">Commvault teams app id</param> /// <param name="body">Request Message to add content to teams app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddTeamsContentWithResult(long appId, Commvault.Powershell.Models.ITeamsContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams/" + (appId.ToString()) + "/Content" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AddTeamsContentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "AddTeamsContentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AddTeamsContentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "AddTeamsContent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddTeamsContent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="AddTeamsContent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="appId">Commvault teams app id</param> /// <param name="body">Request Message to add content to teams app</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AddTeamsContent_Validate(long appId, Commvault.Powershell.Models.ITeamsContentReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary> /// This operation is applicable only for HyperScale X Storage Pool. /// When the storage utilization is above 85%, it will be marked read only on next Tuesday. /// As long as utilization is below 90%, this API can be used to allow backup operation on the storage for an additional week. /// </summary> /// <param name="storagePoolId">Id of the HyperScale X storage pool</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AllowBackupOpOnHyperScaleXStoragePool(long storagePoolId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + (storagePoolId.ToString()) + "/Extend" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AllowBackupOpOnHyperScaleXStoragePool_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary> /// This operation is applicable only for HyperScale X Storage Pool. /// When the storage utilization is above 85%, it will be marked read only on next Tuesday. /// As long as utilization is below 90%, this API can be used to allow backup operation on the storage for an additional week. /// </summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AllowBackupOpOnHyperScaleXStoragePoolViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/HyperScale/(?<storagePoolId>[^/]+)/Extend$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/HyperScale/{storagePoolId}/Extend'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + storagePoolId + "/Extend" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AllowBackupOpOnHyperScaleXStoragePool_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary> /// This operation is applicable only for HyperScale X Storage Pool. /// When the storage utilization is above 85%, it will be marked read only on next Tuesday. /// As long as utilization is below 90%, this API can be used to allow backup operation on the storage for an additional week. /// </summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> AllowBackupOpOnHyperScaleXStoragePoolViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/HyperScale/(?<storagePoolId>[^/]+)/Extend$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/HyperScale/{storagePoolId}/Extend'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + storagePoolId + "/Extend" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AllowBackupOpOnHyperScaleXStoragePoolWithResult_Call (request, eventListener,sender); } } /// <summary> /// This operation is applicable only for HyperScale X Storage Pool. /// When the storage utilization is above 85%, it will be marked read only on next Tuesday. /// As long as utilization is below 90%, this API can be used to allow backup operation on the storage for an additional week. /// </summary> /// <param name="storagePoolId">Id of the HyperScale X storage pool</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> AllowBackupOpOnHyperScaleXStoragePoolWithResult(long storagePoolId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + (storagePoolId.ToString()) + "/Extend" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AllowBackupOpOnHyperScaleXStoragePoolWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "AllowBackupOpOnHyperScaleXStoragePoolWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> AllowBackupOpOnHyperScaleXStoragePoolWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "AllowBackupOpOnHyperScaleXStoragePool" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AllowBackupOpOnHyperScaleXStoragePool_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="AllowBackupOpOnHyperScaleXStoragePool" /> method. Call this like the actual call, but /// you will get validation events back. /// </summary> /// <param name="storagePoolId">Id of the HyperScale X storage pool</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AllowBackupOpOnHyperScaleXStoragePool_Validate(long storagePoolId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to manage MediaAgents associated with the Storage Pool</summary> /// <param name="storagePoolId">Id of the Storage Pool</param> /// <param name="mediaAgentId">Id of the MediaAgent</param> /// <param name="action">Action to performed on the MediaAgent</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AssociateMaWithStoragePool(long storagePoolId, long mediaAgentId, string action, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + (storagePoolId.ToString()) + "/MediaAgent" + "?" + "mediaAgentId=" + global::System.Uri.EscapeDataString(mediaAgentId.ToString()) + "&" + "action=" + global::System.Uri.EscapeDataString(action) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AssociateMaWithStoragePool_Call (request, onOk,eventListener,sender); } } /// <summary>API to manage MediaAgents associated with the Storage Pool</summary> /// <param name="viaIdentity"></param> /// <param name="mediaAgentId">Id of the MediaAgent</param> /// <param name="action">Action to performed on the MediaAgent</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task AssociateMaWithStoragePoolViaIdentity(global::System.String viaIdentity, long mediaAgentId, string action, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StoragePool/(?<storagePoolId>[^/]+)/MediaAgent$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StoragePool/{storagePoolId}/MediaAgent'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + storagePoolId + "/MediaAgent" + "?" + "mediaAgentId=" + global::System.Uri.EscapeDataString(mediaAgentId.ToString()) + "&" + "action=" + global::System.Uri.EscapeDataString(action) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.AssociateMaWithStoragePool_Call (request, onOk,eventListener,sender); } } /// <summary>API to manage MediaAgents associated with the Storage Pool</summary> /// <param name="viaIdentity"></param> /// <param name="mediaAgentId">Id of the MediaAgent</param> /// <param name="action">Action to performed on the MediaAgent</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AssociateMaWithStoragePoolViaIdentityWithResult(global::System.String viaIdentity, long mediaAgentId, string action, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StoragePool/(?<storagePoolId>[^/]+)/MediaAgent$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StoragePool/{storagePoolId}/MediaAgent'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + storagePoolId + "/MediaAgent" + "?" + "mediaAgentId=" + global::System.Uri.EscapeDataString(mediaAgentId.ToString()) + "&" + "action=" + global::System.Uri.EscapeDataString(action) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AssociateMaWithStoragePoolWithResult_Call (request, eventListener,sender); } } /// <summary>API to manage MediaAgents associated with the Storage Pool</summary> /// <param name="storagePoolId">Id of the Storage Pool</param> /// <param name="mediaAgentId">Id of the MediaAgent</param> /// <param name="action">Action to performed on the MediaAgent</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AssociateMaWithStoragePoolWithResult(long storagePoolId, long mediaAgentId, string action, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + (storagePoolId.ToString()) + "/MediaAgent" + "?" + "mediaAgentId=" + global::System.Uri.EscapeDataString(mediaAgentId.ToString()) + "&" + "action=" + global::System.Uri.EscapeDataString(action) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.AssociateMaWithStoragePoolWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "AssociateMaWithStoragePoolWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> AssociateMaWithStoragePoolWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "AssociateMaWithStoragePool" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AssociateMaWithStoragePool_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="AssociateMaWithStoragePool" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="storagePoolId">Id of the Storage Pool</param> /// <param name="mediaAgentId">Id of the MediaAgent</param> /// <param name="action">Action to performed on the MediaAgent</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task AssociateMaWithStoragePool_Validate(long storagePoolId, long mediaAgentId, string action, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(action),action); } } /// <summary>Run backups on server plan associated entities</summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="backupLevel">Backup level of jobs</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task BackupServerPlan(long planId, string backupLevel, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onUnauthorized, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/Backup" + "?" + "backupLevel=" + global::System.Uri.EscapeDataString(backupLevel) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.BackupServerPlan_Call (request, onOk,onUnauthorized,onInternalServerError,eventListener,sender); } } /// <summary>Run backups on server plan associated entities</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="body">Server plan immediate backup request</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task BackupServerPlan1(long planId, Commvault.Powershell.Models.IServerPlanBackupRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onUnauthorized, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/RPO/Run" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.BackupServerPlan1_Call (request, onOk,onUnauthorized,onInternalServerError,eventListener,sender); } } /// <summary>Run backups on server plan associated entities</summary> /// <param name="viaIdentity"></param> /// <param name="body">Server plan immediate backup request</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task BackupServerPlan1ViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IServerPlanBackupRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onUnauthorized, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/RPO/Run$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/RPO/Run'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/RPO/Run" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.BackupServerPlan1_Call (request, onOk,onUnauthorized,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "BackupServerPlan1" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task BackupServerPlan1_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onUnauthorized, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onUnauthorized(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="BackupServerPlan1" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="body">Server plan immediate backup request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task BackupServerPlan1_Validate(long planId, Commvault.Powershell.Models.IServerPlanBackupRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Run backups on server plan associated entities</summary> /// <param name="viaIdentity"></param> /// <param name="backupLevel">Backup level of jobs</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task BackupServerPlanViaIdentity(global::System.String viaIdentity, string backupLevel, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onUnauthorized, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/Backup$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/Backup'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/Backup" + "?" + "backupLevel=" + global::System.Uri.EscapeDataString(backupLevel) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.BackupServerPlan_Call (request, onOk,onUnauthorized,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "BackupServerPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task BackupServerPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onUnauthorized, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onUnauthorized(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="BackupServerPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="backupLevel">Backup level of jobs</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task BackupServerPlan_Validate(long planId, string backupLevel, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(backupLevel),backupLevel); } } /// <summary>API to get all namespaces of a Kubernetes cluster with clusterId</summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task BrowseKubernetesNamespaces(long clusterId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + (clusterId.ToString()) + "/Content/Namespace" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.BrowseKubernetesNamespaces_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to get all namespaces of a Kubernetes cluster with clusterId</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task BrowseKubernetesNamespacesViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Cluster/(?<clusterId>[^/]+)/Content/Namespace$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Cluster/{clusterId}/Content/Namespace'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + clusterId + "/Content/Namespace" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.BrowseKubernetesNamespaces_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "BrowseKubernetesNamespaces" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task BrowseKubernetesNamespaces_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.KubernetesBrowseClusterResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="BrowseKubernetesNamespaces" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task BrowseKubernetesNamespaces_Validate(long clusterId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get all StorageClasses of a Kubernetes cluster with clusterId</summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task BrowseKubernetesStorageClass(long clusterId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + (clusterId.ToString()) + "/Content/StorageClass" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.BrowseKubernetesStorageClass_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to get all StorageClasses of a Kubernetes cluster with clusterId</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task BrowseKubernetesStorageClassViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Cluster/(?<clusterId>[^/]+)/Content/StorageClass$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Cluster/{clusterId}/Content/StorageClass'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + clusterId + "/Content/StorageClass" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.BrowseKubernetesStorageClass_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "BrowseKubernetesStorageClass" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task BrowseKubernetesStorageClass_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.KubernetesBrowseClusterResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="BrowseKubernetesStorageClass" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task BrowseKubernetesStorageClass_Validate(long clusterId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to browse applications in a namespace</summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="nameSpace">Name of the namespace to browse for content</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task BrowseNamespaceApplications(long clusterId, string nameSpace, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + (clusterId.ToString()) + "/Content/Namespace/" + global::System.Uri.EscapeDataString(nameSpace) + "/Applications" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.BrowseNamespaceApplications_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to browse applications in a namespace</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task BrowseNamespaceApplicationsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Cluster/(?<clusterId>[^/]+)/Content/Namespace/(?<nameSpace>[^/]+)/Applications$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Cluster/{clusterId}/Content/Namespace/{nameSpace}/Applications'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; var nameSpace = _match.Groups["nameSpace"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + clusterId + "/Content/Namespace/" + nameSpace + "/Applications" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.BrowseNamespaceApplications_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "BrowseNamespaceApplications" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task BrowseNamespaceApplications_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.KubernetesBrowseClusterResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="BrowseNamespaceApplications" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="nameSpace">Name of the namespace to browse for content</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task BrowseNamespaceApplications_Validate(long clusterId, string nameSpace, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(nameSpace),nameSpace); } } /// <summary>API to browse labels in a namespace</summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="nameSpace">Name of the namespace to browse for content</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task BrowseNamespaceLabels(long clusterId, string nameSpace, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + (clusterId.ToString()) + "/Content/Namespace/" + global::System.Uri.EscapeDataString(nameSpace) + "/Labels" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.BrowseNamespaceLabels_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to browse labels in a namespace</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task BrowseNamespaceLabelsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Cluster/(?<clusterId>[^/]+)/Content/Namespace/(?<nameSpace>[^/]+)/Labels$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Cluster/{clusterId}/Content/Namespace/{nameSpace}/Labels'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; var nameSpace = _match.Groups["nameSpace"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + clusterId + "/Content/Namespace/" + nameSpace + "/Labels" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.BrowseNamespaceLabels_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "BrowseNamespaceLabels" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task BrowseNamespaceLabels_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.KubernetesBrowseClusterResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="BrowseNamespaceLabels" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="nameSpace">Name of the namespace to browse for content</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task BrowseNamespaceLabels_Validate(long clusterId, string nameSpace, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(nameSpace),nameSpace); } } /// <summary>API to browse volumes in a namespace</summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="nameSpace">Name of the namespace to browse for content</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task BrowseNamespaceVolumes(long clusterId, string nameSpace, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + (clusterId.ToString()) + "/Content/Namespace/" + global::System.Uri.EscapeDataString(nameSpace) + "/Volumes" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.BrowseNamespaceVolumes_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to browse volumes in a namespace</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task BrowseNamespaceVolumesViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Cluster/(?<clusterId>[^/]+)/Content/Namespace/(?<nameSpace>[^/]+)/Volumes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Cluster/{clusterId}/Content/Namespace/{nameSpace}/Volumes'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; var nameSpace = _match.Groups["nameSpace"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + clusterId + "/Content/Namespace/" + nameSpace + "/Volumes" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.BrowseNamespaceVolumes_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "BrowseNamespaceVolumes" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task BrowseNamespaceVolumes_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesBrowseClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.KubernetesBrowseClusterResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="BrowseNamespaceVolumes" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="nameSpace">Name of the namespace to browse for content</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task BrowseNamespaceVolumes_Validate(long clusterId, string nameSpace, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(nameSpace),nameSpace); } } /// <summary> /// Used to fetch available media agents which can be added as access paths for cloud storage /// </summary> /// <param name="cloudStorageId">Id of the cloud storage pool for which media agent has to be added</param> /// <param name="bucketId">Id of the access path of which media agent has to be shared</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CloudGetEligibleMediaAgentsForAccessPath(long cloudStorageId, long bucketId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/Bucket/" + (bucketId.ToString()) + "/AccessPath/MediaAgents" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CloudGetEligibleMediaAgentsForAccessPath_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary> /// Used to fetch available media agents which can be added as access paths for cloud storage /// </summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CloudGetEligibleMediaAgentsForAccessPathViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/Bucket/(?<bucketId>[^/]+)/AccessPath/MediaAgents$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/Bucket/{bucketId}/AccessPath/MediaAgents'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var bucketId = _match.Groups["bucketId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/Bucket/" + bucketId + "/AccessPath/MediaAgents" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CloudGetEligibleMediaAgentsForAccessPath_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary> /// Used to fetch available media agents which can be added as access paths for cloud storage /// </summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList> CloudGetEligibleMediaAgentsForAccessPathViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/Bucket/(?<bucketId>[^/]+)/AccessPath/MediaAgents$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/Bucket/{bucketId}/AccessPath/MediaAgents'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var bucketId = _match.Groups["bucketId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/Bucket/" + bucketId + "/AccessPath/MediaAgents" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CloudGetEligibleMediaAgentsForAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary> /// Used to fetch available media agents which can be added as access paths for cloud storage /// </summary> /// <param name="cloudStorageId">Id of the cloud storage pool for which media agent has to be added</param> /// <param name="bucketId">Id of the access path of which media agent has to be shared</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList> CloudGetEligibleMediaAgentsForAccessPathWithResult(long cloudStorageId, long bucketId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/Bucket/" + (bucketId.ToString()) + "/AccessPath/MediaAgents" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CloudGetEligibleMediaAgentsForAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "CloudGetEligibleMediaAgentsForAccessPathWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList> CloudGetEligibleMediaAgentsForAccessPathWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MediaAgentList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "CloudGetEligibleMediaAgentsForAccessPath" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CloudGetEligibleMediaAgentsForAccessPath_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MediaAgentList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CloudGetEligibleMediaAgentsForAccessPath" /> method. Call this like the actual call, /// but you will get validation events back. /// </summary> /// <param name="cloudStorageId">Id of the cloud storage pool for which media agent has to be added</param> /// <param name="bucketId">Id of the access path of which media agent has to be shared</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CloudGetEligibleMediaAgentsForAccessPath_Validate(long cloudStorageId, long bucketId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Compare old and new XMl or objects</summary> /// <param name="body">This is the data model to compare two objects</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CompareXmls(Commvault.Powershell.Models.ICompareXmlReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompareXmlResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CompareXML" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CompareXmls_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Compare old and new XMl or objects</summary> /// <param name="body">This is the data model to compare two objects</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompareXmlResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompareXmlResp> CompareXmlsWithResult(Commvault.Powershell.Models.ICompareXmlReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CompareXML" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CompareXmlsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CompareXmlsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompareXmlResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompareXmlResp> CompareXmlsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CompareXmlResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CompareXmls" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CompareXmls_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompareXmlResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CompareXmlResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CompareXmls" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="body">This is the data model to compare two objects</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CompareXmls_Validate(Commvault.Powershell.Models.ICompareXmlReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Configures Cyber Resilience in the environment</summary> /// <param name="body">CyberResilienceConfigureRequest</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ConfigureCyberResilience(Commvault.Powershell.Models.ICyberResilienceConfigureRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CyberResilience" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ConfigureCyberResilience_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Configures Cyber Resilience in the environment</summary> /// <param name="body">CyberResilienceConfigureRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse> ConfigureCyberResilienceWithResult(Commvault.Powershell.Models.ICyberResilienceConfigureRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CyberResilience" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ConfigureCyberResilienceWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ConfigureCyberResilienceWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>" /> that /// will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse> ConfigureCyberResilienceWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "ConfigureCyberResilience" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ConfigureCyberResilience_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ConfigureCyberResilience" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="body">CyberResilienceConfigureRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ConfigureCyberResilience_Validate(Commvault.Powershell.Models.ICyberResilienceConfigureRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Configure SMTP server settings.</summary> /// <param name="body">ConfigureSMTPServerReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ConfigureEmailServer(Commvault.Powershell.Models.IConfigureSmtpServerReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onUnauthorized, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EmailServer" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ConfigureEmailServer_Call (request, onOk,onBadRequest,onUnauthorized,eventListener,sender); } } /// <summary>Configure SMTP server settings.</summary> /// <param name="body">ConfigureSMTPServerReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ConfigureEmailServerWithResult(Commvault.Powershell.Models.IConfigureSmtpServerReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EmailServer" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ConfigureEmailServerWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ConfigureEmailServerWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ConfigureEmailServerWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "ConfigureEmailServer" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ConfigureEmailServer_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onUnauthorized, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onUnauthorized(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ConfigureEmailServer" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">ConfigureSMTPServerReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ConfigureEmailServer_Validate(Commvault.Powershell.Models.IConfigureSmtpServerReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>This endpoint configures a syslog server.</summary> /// <param name="body">This operation configures a syslog server.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ConfigureSyslogStatus(Commvault.Powershell.Models.ISyslogConfigure body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/syslogServer" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ConfigureSyslogStatus_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>This endpoint configures a syslog server.</summary> /// <param name="body">This operation configures a syslog server.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ConfigureSyslogStatusWithResult(Commvault.Powershell.Models.ISyslogConfigure body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/syslogServer" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ConfigureSyslogStatusWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ConfigureSyslogStatusWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ConfigureSyslogStatusWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "ConfigureSyslogStatus" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ConfigureSyslogStatus_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ConfigureSyslogStatus" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">This operation configures a syslog server.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ConfigureSyslogStatus_Validate(Commvault.Powershell.Models.ISyslogConfigure body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary> /// Add a new Access path (mediaAgent) to a specific bucket of a specific cloud storage /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="bucketId">Id of Bucket</param> /// <param name="body">Used to add a new access path to a bucket</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateAccessPathForBucketOfCloudStorage(long cloudStorageId, long bucketId, Commvault.Powershell.Models.IPaths4Yo4LoV4StorageCloudCloudstorageidBucketBucketidAccesspathPostRequestbodyContentApplicationJsonSchema body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/Bucket/" + (bucketId.ToString()) + "/AccessPath" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateAccessPathForBucketOfCloudStorage_Call (request, onOk,onBadRequest,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary> /// Add a new Access path (mediaAgent) to a specific bucket of a specific cloud storage /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to add a new access path to a bucket</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateAccessPathForBucketOfCloudStorageViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IPaths4Yo4LoV4StorageCloudCloudstorageidBucketBucketidAccesspathPostRequestbodyContentApplicationJsonSchema body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/Bucket/(?<bucketId>[^/]+)/AccessPath$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/Bucket/{bucketId}/AccessPath'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var bucketId = _match.Groups["bucketId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/Bucket/" + bucketId + "/AccessPath" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateAccessPathForBucketOfCloudStorage_Call (request, onOk,onBadRequest,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary> /// Add a new Access path (mediaAgent) to a specific bucket of a specific cloud storage /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to add a new access path to a bucket</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateAccessPathForBucketOfCloudStorageViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IPaths4Yo4LoV4StorageCloudCloudstorageidBucketBucketidAccesspathPostRequestbodyContentApplicationJsonSchema body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/Bucket/(?<bucketId>[^/]+)/AccessPath$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/Bucket/{bucketId}/AccessPath'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var bucketId = _match.Groups["bucketId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/Bucket/" + bucketId + "/AccessPath" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateAccessPathForBucketOfCloudStorageWithResult_Call (request, eventListener,sender); } } /// <summary> /// Add a new Access path (mediaAgent) to a specific bucket of a specific cloud storage /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="bucketId">Id of Bucket</param> /// <param name="body">Used to add a new access path to a bucket</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateAccessPathForBucketOfCloudStorageWithResult(long cloudStorageId, long bucketId, Commvault.Powershell.Models.IPaths4Yo4LoV4StorageCloudCloudstorageidBucketBucketidAccesspathPostRequestbodyContentApplicationJsonSchema body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/Bucket/" + (bucketId.ToString()) + "/AccessPath" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateAccessPathForBucketOfCloudStorageWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "CreateAccessPathForBucketOfCloudStorageWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateAccessPathForBucketOfCloudStorageWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "CreateAccessPathForBucketOfCloudStorage" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateAccessPathForBucketOfCloudStorage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateAccessPathForBucketOfCloudStorage" /> method. Call this like the actual call, but /// you will get validation events back. /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="bucketId">Id of Bucket</param> /// <param name="body">Used to add a new access path to a bucket</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateAccessPathForBucketOfCloudStorage_Validate(long cloudStorageId, long bucketId, Commvault.Powershell.Models.IPaths4Yo4LoV4StorageCloudCloudstorageidBucketBucketidAccesspathPostRequestbodyContentApplicationJsonSchema body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create Alert Definitions</summary> /// <param name="body">AlertDefinitonsCreate</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateAlertDefinitions(Commvault.Powershell.Models.IAlertDefinitonsCreate body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateAlertDefinitions_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Create Alert Definitions</summary> /// <param name="body">AlertDefinitonsCreate</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid> CreateAlertDefinitionsWithResult(Commvault.Powershell.Models.IAlertDefinitonsCreate body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateAlertDefinitionsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateAlertDefinitionsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid> CreateAlertDefinitionsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdNameGuid.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateAlertDefinitions" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateAlertDefinitions_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdNameGuid.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateAlertDefinitions" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">AlertDefinitonsCreate</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateAlertDefinitions_Validate(Commvault.Powershell.Models.IAlertDefinitonsCreate body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateArchiveBackupDestination(long planId, Commvault.Powershell.Models.ICreateArchivePlanBackupDestinations body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) + "/BackupDestination" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateArchiveBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Create a Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateArchiveBackupDestinationViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ICreateArchivePlanBackupDestinations body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)/BackupDestination$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}/BackupDestination'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId + "/BackupDestination" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateArchiveBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Create a Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> CreateArchiveBackupDestinationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ICreateArchivePlanBackupDestinations body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)/BackupDestination$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}/BackupDestination'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId + "/BackupDestination" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateArchiveBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary>Create a Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> CreateArchiveBackupDestinationWithResult(long planId, Commvault.Powershell.Models.ICreateArchivePlanBackupDestinations body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) + "/BackupDestination" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateArchiveBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "CreateArchiveBackupDestinationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> CreateArchiveBackupDestinationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateArchiveBackupDestination" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateArchiveBackupDestination_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateArchiveBackupDestination" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateArchiveBackupDestination_Validate(long planId, Commvault.Powershell.Models.ICreateArchivePlanBackupDestinations body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create Archive Plan</summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateArchivePlan(Commvault.Powershell.Models.IArchivePlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateArchivePlan_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateArchivePlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateArchivePlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateArchivePlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateArchivePlan_Validate(Commvault.Powershell.Models.IArchivePlan body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Creating a Storage Array</summary> /// <param name="body">Request to create an Array</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateArray(Commvault.Powershell.Models.ICreateArray body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateArray_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Creating a Storage Array</summary> /// <param name="body">Request to create an Array</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateArrayWithResult(Commvault.Powershell.Models.ICreateArray body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateArrayWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateArrayWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateArrayWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateArray" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateArray_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateArray" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="body">Request to create an Array</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateArray_Validate(Commvault.Powershell.Models.ICreateArray body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create Azure Active Directory app</summary> /// <param name="body">Request Message for Azure active directory app creation</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateAzureAdClient(Commvault.Powershell.Models.ICreateAzureAdClient body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/ActiveDirectory/AzureAD" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateAzureAdClient_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Create Azure Active Directory app</summary> /// <param name="body">Request Message for Azure active directory app creation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateAzureAdClientWithResult(Commvault.Powershell.Models.ICreateAzureAdClient body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/ActiveDirectory/AzureAD" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateAzureAdClientWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateAzureAdClientWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateAzureAdClientWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateAzureAdClient" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateAzureAdClient_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateAzureAdClient" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Request Message for Azure active directory app creation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateAzureAdClient_Validate(Commvault.Powershell.Models.ICreateAzureAdClient body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateBackupDestination(long planId, Commvault.Powershell.Models.ICreatePlanBackupDestinations body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/BackupDestination" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Create a Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateBackupDestinationViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ICreatePlanBackupDestinations body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/BackupDestination$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/BackupDestination'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/BackupDestination" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Create a Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> CreateBackupDestinationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ICreatePlanBackupDestinations body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/BackupDestination$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/BackupDestination'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/BackupDestination" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary>Create a Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> CreateBackupDestinationWithResult(long planId, Commvault.Powershell.Models.ICreatePlanBackupDestinations body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/BackupDestination" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateBackupDestinationWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> CreateBackupDestinationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Create backup destination(s) for a plan before creating the plan. /// The primary backup destination can be then associated with the plan to associate all secondary copies also. /// </summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateBackupDestinationWithoutPlanInfo(Commvault.Powershell.Models.ICreateBackupDestinations body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreatePlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateBackupDestinationWithoutPlanInfo_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary> /// Create backup destination(s) for a plan before creating the plan. /// The primary backup destination can be then associated with the plan to associate all secondary copies also. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreatePlanBackupDestinationResp>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreatePlanBackupDestinationResp> CreateBackupDestinationWithoutPlanInfoWithResult(Commvault.Powershell.Models.ICreateBackupDestinations body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateBackupDestinationWithoutPlanInfoWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "CreateBackupDestinationWithoutPlanInfoWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreatePlanBackupDestinationResp>" /> that /// will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreatePlanBackupDestinationResp> CreateBackupDestinationWithoutPlanInfoWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreatePlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "CreateBackupDestinationWithoutPlanInfo" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateBackupDestinationWithoutPlanInfo_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreatePlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreatePlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateBackupDestinationWithoutPlanInfo" /> method. Call this like the actual call, but /// you will get validation events back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateBackupDestinationWithoutPlanInfo_Validate(Commvault.Powershell.Models.ICreateBackupDestinations body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Actual wire call for <see cref= "CreateBackupDestination" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateBackupDestination_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateBackupDestination" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateBackupDestination_Validate(long planId, Commvault.Powershell.Models.ICreatePlanBackupDestinations body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a new backup location</summary> /// <param name="storagePoolId">Id of the disk storage to update</param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateBackupLocation(long storagePoolId, Commvault.Powershell.Models.ICreateBackupLocation body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateBackupLocation_Call (request, onOk,onBadRequest,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Create a new backup location</summary> /// <param name="viaIdentity"></param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateBackupLocationViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ICreateBackupLocation body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateBackupLocation_Call (request, onOk,onBadRequest,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Create a new backup location</summary> /// <param name="viaIdentity"></param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateBackupLocationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ICreateBackupLocation body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateBackupLocationWithResult_Call (request, eventListener,sender); } } /// <summary>Create a new backup location</summary> /// <param name="storagePoolId">Id of the disk storage to update</param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateBackupLocationWithResult(long storagePoolId, Commvault.Powershell.Models.ICreateBackupLocation body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateBackupLocationWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateBackupLocationWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateBackupLocationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateBackupLocation" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateBackupLocation_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateBackupLocation" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the disk storage to update</param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateBackupLocation_Validate(long storagePoolId, Commvault.Powershell.Models.ICreateBackupLocation body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a Blackout Window</summary> /// <param name="body">betweenDates refers to the dates where the blackout window will be in effect. Dates have to be given /// in unix time format. time has to be provided in seconds. company refers to company to which the blackout window is associated.Id /// is given first preference if both are id and name are provided.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateBlackoutWindow(Commvault.Powershell.Models.ICreateBlackoutWindow body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/BlackoutWindow" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateBlackoutWindow_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Create a Blackout Window</summary> /// <param name="body">betweenDates refers to the dates where the blackout window will be in effect. Dates have to be given /// in unix time format. time has to be provided in seconds. company refers to company to which the blackout window is associated.Id /// is given first preference if both are id and name are provided.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateBlackoutWindowWithResult(Commvault.Powershell.Models.ICreateBlackoutWindow body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/BlackoutWindow" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateBlackoutWindowWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateBlackoutWindowWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateBlackoutWindowWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateBlackoutWindow" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateBlackoutWindow_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateBlackoutWindow" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">betweenDates refers to the dates where the blackout window will be in effect. Dates have to be given /// in unix time format. time has to be provided in seconds. company refers to company to which the blackout window is associated.Id /// is given first preference if both are id and name are provided.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateBlackoutWindow_Validate(Commvault.Powershell.Models.ICreateBlackoutWindow body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a CDM Plan</summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateCdmPlan(Commvault.Powershell.Models.ICreateCdmPlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CDMPlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateCdmPlan_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Create a CDM Plan</summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp> CreateCdmPlanWithResult(Commvault.Powershell.Models.ICreateCdmPlan body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CDMPlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateCdmPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateCdmPlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp> CreateCdmPlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateCdmPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateCdmPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateCdmPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateCdmPlan_Validate(Commvault.Powershell.Models.ICreateCdmPlan body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Add metadata cache paths to storage</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateCloudStorageMetaDataCache(long cloudStorageId, Commvault.Powershell.Models.ICreateMetadataCacheConfigurations body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/MetadataCache" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateCloudStorageMetaDataCache_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Add metadata cache paths to storage</summary> /// <param name="viaIdentity"></param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateCloudStorageMetaDataCacheViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ICreateMetadataCacheConfigurations body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/MetadataCache$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/MetadataCache'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/MetadataCache" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateCloudStorageMetaDataCache_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Add metadata cache paths to storage</summary> /// <param name="viaIdentity"></param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateCloudStorageMetaDataCacheViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ICreateMetadataCacheConfigurations body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/MetadataCache$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/MetadataCache'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/MetadataCache" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateCloudStorageMetaDataCacheWithResult_Call (request, eventListener,sender); } } /// <summary>Add metadata cache paths to storage</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateCloudStorageMetaDataCacheWithResult(long cloudStorageId, Commvault.Powershell.Models.ICreateMetadataCacheConfigurations body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/MetadataCache" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateCloudStorageMetaDataCacheWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "CreateCloudStorageMetaDataCacheWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateCloudStorageMetaDataCacheWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateCloudStorageMetaDataCache" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateCloudStorageMetaDataCache_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateCloudStorageMetaDataCache" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateCloudStorageMetaDataCache_Validate(long cloudStorageId, Commvault.Powershell.Models.ICreateMetadataCacheConfigurations body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a Company</summary> /// <param name="body">Used to create a new company</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateCompany(Commvault.Powershell.Models.ICreateCompany body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateCompany_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Create a Company</summary> /// <param name="body">Used to create a new company</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateCompanyWithResult(Commvault.Powershell.Models.ICreateCompany body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateCompanyWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateCompanyWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateCompanyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateCompany" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateCompany_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateCompany" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Used to create a new company</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateCompany_Validate(Commvault.Powershell.Models.ICreateCompany body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary> /// Used to create CVFS S3 bucket and assigns READ-WRITE permission to the requesting user /// </summary> /// <param name="body">CreateCVFSS3Bucket</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateCvfsS3Bucket(Commvault.Powershell.Models.ICreateCvfss3Bucket body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateCvfss3BucketResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateCvfsS3Bucket_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateCvfsS3Bucket" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateCvfsS3Bucket_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateCvfss3BucketResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateCvfss3BucketResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateCvfsS3Bucket" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">CreateCVFSS3Bucket</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateCvfsS3Bucket_Validate(Commvault.Powershell.Models.ICreateCvfss3Bucket body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create Dynamics 365 app</summary> /// <param name="body">Request Message for Dynamics365 app creation</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateD365Client(Commvault.Powershell.Models.ICreateDynamics365Client body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/Dynamics365" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateD365Client_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Create Dynamics 365 app</summary> /// <param name="body">Request Message for Dynamics365 app creation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateD365ClientWithResult(Commvault.Powershell.Models.ICreateDynamics365Client body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/Dynamics365" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateD365ClientWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateD365ClientWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateD365ClientWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateD365Client" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateD365Client_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateD365Client" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Request Message for Dynamics365 app creation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateD365Client_Validate(Commvault.Powershell.Models.ICreateDynamics365Client body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a Data Classification Plan</summary> /// <param name="body">Create Data Classification Plan Request Model</param> /// <param name="onCreated">a delegate that is called when the remote service returns 201 (Created).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateDcPlan(Commvault.Powershell.Models.ICreateDcPlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>, global::System.Threading.Tasks.Task> onCreated, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DCPlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateDcPlan_Call (request, onCreated,onBadRequest,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateDcPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onCreated">a delegate that is called when the remote service returns 201 (Created).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateDcPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>, global::System.Threading.Tasks.Task> onCreated, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.Created: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateDcPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Create Data Classification Plan Request Model</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateDcPlan_Validate(Commvault.Powershell.Models.ICreateDcPlan body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a new disk storage pool</summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateDiskStorage(Commvault.Powershell.Models.ICreateDiskStorage body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateDiskStorage_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Create a new disk storage pool</summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateDiskStorageWithResult(Commvault.Powershell.Models.ICreateDiskStorage body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateDiskStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateDiskStorageWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateDiskStorageWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateDiskStorage" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateDiskStorage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateDiskStorage" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateDiskStorage_Validate(Commvault.Powershell.Models.ICreateDiskStorage body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a backup destination for CommServe DR Backups</summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateDrBackupDestination(Commvault.Powershell.Models.ICreatePlanBackupDestinations body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DRBackup/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateDrBackupDestination_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateDrBackupDestination" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateDrBackupDestination_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateDrBackupDestination" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateDrBackupDestination_Validate(Commvault.Powershell.Models.ICreatePlanBackupDestinations body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create Office 365 Exchange Online app</summary> /// <param name="body">Request Message for exchange app creation</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateExchangeClient(Commvault.Powershell.Models.ICreateExchangeClient body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateExchangeClient_Call (request, onOk,onConflict,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateExchangeClient" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateExchangeClient_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Conflict: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onConflict(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateExchangeClient" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Request Message for exchange app creation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateExchangeClient_Validate(Commvault.Powershell.Models.ICreateExchangeClient body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to create failover group DR operation schedule</summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="body">Used to describe single plan schedule information</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateFailoverGroupSchedule(long failoverGroupId, Commvault.Powershell.Models.IPlanSchedule body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSchedule>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + (failoverGroupId.ToString()) + "/Schedules" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateFailoverGroupSchedule_Call (request, onOk,onBadRequest,onServiceUnavailable,eventListener,sender); } } /// <summary>API to create failover group DR operation schedule</summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to describe single plan schedule information</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateFailoverGroupScheduleViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IPlanSchedule body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSchedule>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/FailoverGroups/(?<failoverGroupId>[^/]+)/Schedules$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/FailoverGroups/{failoverGroupId}/Schedules'"); } // replace URI parameters with values from identity var failoverGroupId = _match.Groups["failoverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + failoverGroupId + "/Schedules" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateFailoverGroupSchedule_Call (request, onOk,onBadRequest,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateFailoverGroupSchedule" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateFailoverGroupSchedule_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSchedule>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanSchedule.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateFailoverGroupSchedule" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="body">Used to describe single plan schedule information</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateFailoverGroupSchedule_Validate(long failoverGroupId, Commvault.Powershell.Models.IPlanSchedule body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a Global Server Plan</summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateGlobalServerPlan(Commvault.Powershell.Models.ICreateGlobalServerPlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Global/ServerPlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateGlobalServerPlan_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Create a Global Server Plan</summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp> CreateGlobalServerPlanWithResult(Commvault.Powershell.Models.ICreateGlobalServerPlan body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Global/ServerPlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateGlobalServerPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateGlobalServerPlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp> CreateGlobalServerPlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateGlobalServerPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateGlobalServerPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateGlobalServerPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateGlobalServerPlan_Validate(Commvault.Powershell.Models.ICreateGlobalServerPlan body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a HyperScale Storage</summary> /// <param name="body">HyperScaleStorage</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateHyperScaleStorage(Commvault.Powershell.Models.IHyperScaleStorage body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHyperScaleStorageResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateHyperScaleStorage_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateHyperScaleStorage" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateHyperScaleStorage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHyperScaleStorageResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.HyperScaleStorageResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateHyperScaleStorage" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="body">HyperScaleStorage</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateHyperScaleStorage_Validate(Commvault.Powershell.Models.IHyperScaleStorage body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Creating a new inventory</summary> /// <param name="body">InventoryCreateRequest</param> /// <param name="onCreated">a delegate that is called when the remote service returns 201 (Created).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateInventory(Commvault.Powershell.Models.IInventoryCreateRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onCreated, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateInventory_Call (request, onCreated,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateInventory" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onCreated">a delegate that is called when the remote service returns 201 (Created).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateInventory_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onCreated, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.Created: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateInventory" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">InventoryCreateRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateInventory_Validate(Commvault.Powershell.Models.IInventoryCreateRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to create new Kubernetes application group</summary> /// <param name="body">Create Application Group Request</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateKubernetesApplicationGroup(Commvault.Powershell.Models.ICreateApplicationGroupRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateKubernetesApplicationGroup_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateKubernetesApplicationGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateKubernetesApplicationGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateKubernetesApplicationGroup" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="body">Create Application Group Request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateKubernetesApplicationGroup_Validate(Commvault.Powershell.Models.ICreateApplicationGroupRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to create new Kubernetes cluster client</summary> /// <param name="body">Request definition for creating Kubernetes cluster</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateKubernetesClusterOp(Commvault.Powershell.Models.ICreateKubernetesClusterRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateKubernetesClusterResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateKubernetesClusterOp_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateKubernetesClusterOp" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateKubernetesClusterOp_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateKubernetesClusterResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateKubernetesClusterResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateKubernetesClusterOp" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="body">Request definition for creating Kubernetes cluster</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateKubernetesClusterOp_Validate(Commvault.Powershell.Models.ICreateKubernetesClusterRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create Kubernetes cluster</summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateKubernetescluster(Commvault.Powershell.Models.ICreateKubernetesCluster body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/cluster" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateKubernetescluster_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateKubernetescluster" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateKubernetescluster_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateClusterResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateKubernetescluster" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateKubernetescluster_Validate(Commvault.Powershell.Models.ICreateKubernetesCluster body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateLaptopBackupDestination(long planId, Commvault.Powershell.Models.ICreatePlanBackupDestinations body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) + "/BackupDestination" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateLaptopBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Create a Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateLaptopBackupDestinationViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ICreatePlanBackupDestinations body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)/BackupDestination$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}/BackupDestination'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId + "/BackupDestination" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateLaptopBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Create a Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> CreateLaptopBackupDestinationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ICreatePlanBackupDestinations body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)/BackupDestination$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}/BackupDestination'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId + "/BackupDestination" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateLaptopBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary>Create a Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> CreateLaptopBackupDestinationWithResult(long planId, Commvault.Powershell.Models.ICreatePlanBackupDestinations body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) + "/BackupDestination" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateLaptopBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "CreateLaptopBackupDestinationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> CreateLaptopBackupDestinationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateLaptopBackupDestination" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateLaptopBackupDestination_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateLaptopBackupDestination" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateLaptopBackupDestination_Validate(long planId, Commvault.Powershell.Models.ICreatePlanBackupDestinations body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a new backup location for local storage.</summary> /// <param name="storagePoolId">Id of the local storage pool to update</param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateLocalBackupLocation(long storagePoolId, Commvault.Powershell.Models.ICreateBackupLocation body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateLocalBackupLocation_Call (request, onOk,onBadRequest,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Create a new backup location for local storage.</summary> /// <param name="viaIdentity"></param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateLocalBackupLocationViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ICreateBackupLocation body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateLocalBackupLocation_Call (request, onOk,onBadRequest,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Create a new backup location for local storage.</summary> /// <param name="viaIdentity"></param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateLocalBackupLocationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ICreateBackupLocation body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateLocalBackupLocationWithResult_Call (request, eventListener,sender); } } /// <summary>Create a new backup location for local storage.</summary> /// <param name="storagePoolId">Id of the local storage pool to update</param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateLocalBackupLocationWithResult(long storagePoolId, Commvault.Powershell.Models.ICreateBackupLocation body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateLocalBackupLocationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "CreateLocalBackupLocationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateLocalBackupLocationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateLocalBackupLocation" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateLocalBackupLocation_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateLocalBackupLocation" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="storagePoolId">Id of the local storage pool to update</param> /// <param name="body">If adding a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateLocalBackupLocation_Validate(long storagePoolId, Commvault.Powershell.Models.ICreateBackupLocation body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a new Local storage pool</summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateLocalStorage(Commvault.Powershell.Models.ICreateLocalStorage body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateLocalStorage_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Create a new Local storage pool</summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateLocalStorageWithResult(Commvault.Powershell.Models.ICreateLocalStorage body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateLocalStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateLocalStorageWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateLocalStorageWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateLocalStorage" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateLocalStorage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateLocalStorage" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateLocalStorage_Validate(Commvault.Powershell.Models.ICreateLocalStorage body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a new role</summary> /// <param name="body">Create a new role.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateNewRole(Commvault.Powershell.Models.ICreateRole body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateNewRole_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Create a new role</summary> /// <param name="body">Create a new role.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid> CreateNewRoleWithResult(Commvault.Powershell.Models.ICreateRole body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateNewRoleWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateNewRoleWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid> CreateNewRoleWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdNameGuid.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateNewRole" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateNewRole_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdNameGuid.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateNewRole" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Create a new role.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateNewRole_Validate(Commvault.Powershell.Models.ICreateRole body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Add nodes for a specific hyperscale storage</summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateNodeforHyperScaleStorage(long hyperScaleStorageId, Commvault.Powershell.Models.IPaths1PkfazfV4StorageHyperscaleHyperscalestorageidNodesPostRequestbodyContentApplicationJsonSchema body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + (hyperScaleStorageId.ToString()) + "/Nodes" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateNodeforHyperScaleStorage_Call (request, onOk,onBadRequest,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Add nodes for a specific hyperscale storage</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateNodeforHyperScaleStorageViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IPaths1PkfazfV4StorageHyperscaleHyperscalestorageidNodesPostRequestbodyContentApplicationJsonSchema body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/HyperScale/(?<hyperScaleStorageId>[^/]+)/Nodes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/HyperScale/{hyperScaleStorageId}/Nodes'"); } // replace URI parameters with values from identity var hyperScaleStorageId = _match.Groups["hyperScaleStorageId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + hyperScaleStorageId + "/Nodes" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateNodeforHyperScaleStorage_Call (request, onOk,onBadRequest,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Add nodes for a specific hyperscale storage</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateNodeforHyperScaleStorageViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IPaths1PkfazfV4StorageHyperscaleHyperscalestorageidNodesPostRequestbodyContentApplicationJsonSchema body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/HyperScale/(?<hyperScaleStorageId>[^/]+)/Nodes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/HyperScale/{hyperScaleStorageId}/Nodes'"); } // replace URI parameters with values from identity var hyperScaleStorageId = _match.Groups["hyperScaleStorageId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + hyperScaleStorageId + "/Nodes" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateNodeforHyperScaleStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Add nodes for a specific hyperscale storage</summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateNodeforHyperScaleStorageWithResult(long hyperScaleStorageId, Commvault.Powershell.Models.IPaths1PkfazfV4StorageHyperscaleHyperscalestorageidNodesPostRequestbodyContentApplicationJsonSchema body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + (hyperScaleStorageId.ToString()) + "/Nodes" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateNodeforHyperScaleStorageWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "CreateNodeforHyperScaleStorageWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateNodeforHyperScaleStorageWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateNodeforHyperScaleStorage" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateNodeforHyperScaleStorage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateNodeforHyperScaleStorage" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateNodeforHyperScaleStorage_Validate(long hyperScaleStorageId, Commvault.Powershell.Models.IPaths1PkfazfV4StorageHyperscaleHyperscalestorageidNodesPostRequestbodyContentApplicationJsonSchema body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a ObjectStore Plan</summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateObjectStorePlan(Commvault.Powershell.Models.ICreateObjectStorePlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ObjectStorePlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateObjectStorePlan_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Create a ObjectStore Plan</summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp> CreateObjectStorePlanWithResult(Commvault.Powershell.Models.ICreateObjectStorePlan body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ObjectStorePlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateObjectStorePlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateObjectStorePlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp> CreateObjectStorePlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateObjectStorePlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateObjectStorePlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateObjectStorePlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateObjectStorePlan_Validate(Commvault.Powershell.Models.ICreateObjectStorePlan body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create Office 365 Onedrive for Business app</summary> /// <param name="body">Request Message for onedrive app creation</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateOnedriveClient(Commvault.Powershell.Models.ICreateOnedriveClient body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/OneDrive" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateOnedriveClient_Call (request, onOk,onConflict,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateOnedriveClient" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateOnedriveClient_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Conflict: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onConflict(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateOnedriveClient" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Request Message for onedrive app creation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateOnedriveClient_Validate(Commvault.Powershell.Models.ICreateOnedriveClient body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary> /// Api to create plan rules. Request body will suggest plan against which rule need to be created and type of entities(workloads /// type, server groups, regions and all) that need to be referenced for applying that rule against a workload. /// </summary> /// <param name="body">This object will send details to create new plan rule. User can provide all rule options or can specify /// a specific rule group. Be default, for rule to be applicable for association to a workload, ALL specified rules in that /// Rule need to be matched.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreatePlanRule(Commvault.Powershell.Models.ICreatePlanEntityRule body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreatePlanRule_Call (request, onOk,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreatePlanRule" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreatePlanRule_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreatePlanRule" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">This object will send details to create new plan rule. User can provide all rule options or can specify /// a specific rule group. Be default, for rule to be applicable for association to a workload, ALL specified rules in that /// Rule need to be matched.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreatePlanRule_Validate(Commvault.Powershell.Models.ICreatePlanEntityRule body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create entities in the recovery group</summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="body">AddUpdateRecoveryEntityRequest</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateRecoveryEntities(long recoveryGroupId, Commvault.Powershell.Models.IAddUpdateRecoveryEntityRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + (recoveryGroupId.ToString()) + "/Entity" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateRecoveryEntities_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Create entities in the recovery group</summary> /// <param name="viaIdentity"></param> /// <param name="body">AddUpdateRecoveryEntityRequest</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateRecoveryEntitiesViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IAddUpdateRecoveryEntityRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/RecoveryGroup/(?<recoveryGroupId>[^/]+)/Entity$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryGroup/{recoveryGroupId}/Entity'"); } // replace URI parameters with values from identity var recoveryGroupId = _match.Groups["recoveryGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + recoveryGroupId + "/Entity" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateRecoveryEntities_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Create entities in the recovery group</summary> /// <param name="viaIdentity"></param> /// <param name="body">AddUpdateRecoveryEntityRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateRecoveryEntitiesViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IAddUpdateRecoveryEntityRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/RecoveryGroup/(?<recoveryGroupId>[^/]+)/Entity$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryGroup/{recoveryGroupId}/Entity'"); } // replace URI parameters with values from identity var recoveryGroupId = _match.Groups["recoveryGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + recoveryGroupId + "/Entity" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateRecoveryEntitiesWithResult_Call (request, eventListener,sender); } } /// <summary>Create entities in the recovery group</summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="body">AddUpdateRecoveryEntityRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateRecoveryEntitiesWithResult(long recoveryGroupId, Commvault.Powershell.Models.IAddUpdateRecoveryEntityRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + (recoveryGroupId.ToString()) + "/Entity" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateRecoveryEntitiesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateRecoveryEntitiesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateRecoveryEntitiesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateRecoveryEntities" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateRecoveryEntities_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateRecoveryEntities" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="body">AddUpdateRecoveryEntityRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateRecoveryEntities_Validate(long recoveryGroupId, Commvault.Powershell.Models.IAddUpdateRecoveryEntityRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create Recovery group</summary> /// <param name="body">Model to provide basic detail of recovery group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateRecoveryGroup(Commvault.Powershell.Models.IRecoveryGroup body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateRecoveryGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Create Recovery group</summary> /// <param name="body">Model to provide basic detail of recovery group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp> CreateRecoveryGroupWithResult(Commvault.Powershell.Models.IRecoveryGroup body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateRecoveryGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateRecoveryGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp> CreateRecoveryGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateRecoveryGroupResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateRecoveryGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateRecoveryGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateRecoveryGroupResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateRecoveryGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Model to provide basic detail of recovery group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateRecoveryGroup_Validate(Commvault.Powershell.Models.IRecoveryGroup body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a region</summary> /// <param name="body">Details of the new region</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateRegion(Commvault.Powershell.Models.ICreateRegion body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateRegion_Call (request, onOk,onBadRequest,onConflict,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateRegion" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateRegion_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdNameGuid.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.Conflict: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onConflict(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateRegion" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Details of the new region</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateRegion_Validate(Commvault.Powershell.Models.ICreateRegion body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create the bucket clone of the given bucket id</summary> /// <param name="id">ID of the bucket</param> /// <param name="body">CreateCVFSS3BucketClone</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateS3BucketClone(long id, Commvault.Powershell.Models.ICreateCvfss3BucketClone body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateCvfss3BucketCloneResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + (id.ToString()) + "/Clone" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateS3BucketClone_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Create the bucket clone of the given bucket id</summary> /// <param name="viaIdentity"></param> /// <param name="body">CreateCVFSS3BucketClone</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateS3BucketCloneViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ICreateCvfss3BucketClone body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateCvfss3BucketCloneResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CVFS/S3Bucket/(?<id>[^/]+)/Clone$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CVFS/S3Bucket/{id}/Clone'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + id + "/Clone" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateS3BucketClone_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateS3BucketClone" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateS3BucketClone_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateCvfss3BucketCloneResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateCvfss3BucketCloneResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateS3BucketClone" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id">ID of the bucket</param> /// <param name="body">CreateCVFSS3BucketClone</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateS3BucketClone_Validate(long id, Commvault.Powershell.Models.ICreateCvfss3BucketClone body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create SAML app</summary> /// <param name="body">Create SAML request</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateSamlApp(Commvault.Powershell.Models.ISamlReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SAML" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateSamlApp_Call (request, onOk,eventListener,sender); } } /// <summary>Create SAML app</summary> /// <param name="body">Create SAML request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateSamlAppWithResult(Commvault.Powershell.Models.ISamlReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SAML" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateSamlAppWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateSamlAppWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> CreateSamlAppWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateSamlApp" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateSamlApp_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateSamlApp" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Create SAML request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateSamlApp_Validate(Commvault.Powershell.Models.ISamlReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create Server group</summary> /// <param name="body">Create a new server group, operation supported for three ServerGroupTypes MANUAL, AUTOMATIC, VIRTUAL_MACHINE</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateServerGroups(Commvault.Powershell.Models.ICreateServerGroup body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerGroupResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateServerGroups_Call (request, onOk,onBadRequest,onForbidden,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateServerGroups" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateServerGroups_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerGroupResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateServerGroupResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateServerGroups" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Create a new server group, operation supported for three ServerGroupTypes MANUAL, AUTOMATIC, VIRTUAL_MACHINE</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateServerGroups_Validate(Commvault.Powershell.Models.ICreateServerGroup body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a Server Plan</summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateServerPlan(Commvault.Powershell.Models.ICreateServerPlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateServerPlan_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>API to create backup content on server plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateServerPlanBackupContent(long planId, Commvault.Powershell.Models.ICreateServerPlanBackupContent body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanBackupContentResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/BackupContent" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateServerPlanBackupContent_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>API to create backup content on server plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateServerPlanBackupContentViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ICreateServerPlanBackupContent body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanBackupContentResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/BackupContent$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/BackupContent'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/BackupContent" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateServerPlanBackupContent_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>API to create backup content on server plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanBackupContentResponse>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanBackupContentResponse> CreateServerPlanBackupContentViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ICreateServerPlanBackupContent body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/BackupContent$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/BackupContent'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/BackupContent" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateServerPlanBackupContentWithResult_Call (request, eventListener,sender); } } /// <summary>API to create backup content on server plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanBackupContentResponse>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanBackupContentResponse> CreateServerPlanBackupContentWithResult(long planId, Commvault.Powershell.Models.ICreateServerPlanBackupContent body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/BackupContent" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateServerPlanBackupContentWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "CreateServerPlanBackupContentWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanBackupContentResponse>" /// /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanBackupContentResponse> CreateServerPlanBackupContentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateServerPlanBackupContentResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateServerPlanBackupContent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateServerPlanBackupContent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanBackupContentResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateServerPlanBackupContentResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateServerPlanBackupContent" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateServerPlanBackupContent_Validate(long planId, Commvault.Powershell.Models.ICreateServerPlanBackupContent body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to create RPO schedules on server plan</summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateServerPlanRpo(long planId, Commvault.Powershell.Models.ICreateServerPlanRpo body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanRpoResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/RPO" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateServerPlanRpo_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>API to create RPO schedules on server plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateServerPlanRpoViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ICreateServerPlanRpo body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanRpoResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/RPO$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/RPO'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/RPO" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateServerPlanRpo_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>API to create RPO schedules on server plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanRpoResponse>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanRpoResponse> CreateServerPlanRpoViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ICreateServerPlanRpo body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/RPO$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/RPO'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/RPO" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateServerPlanRpoWithResult_Call (request, eventListener,sender); } } /// <summary>API to create RPO schedules on server plan</summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanRpoResponse>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanRpoResponse> CreateServerPlanRpoWithResult(long planId, Commvault.Powershell.Models.ICreateServerPlanRpo body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/RPO" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateServerPlanRpoWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateServerPlanRpoWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanRpoResponse>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanRpoResponse> CreateServerPlanRpoWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateServerPlanRpoResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateServerPlanRpo" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateServerPlanRpo_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerPlanRpoResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateServerPlanRpoResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateServerPlanRpo" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateServerPlanRpo_Validate(long planId, Commvault.Powershell.Models.ICreateServerPlanRpo body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a Server Plan</summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp> CreateServerPlanWithResult(Commvault.Powershell.Models.ICreateServerPlan body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateServerPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateServerPlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp> CreateServerPlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateServerPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateServerPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateServerPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateServerPlan_Validate(Commvault.Powershell.Models.ICreateServerPlan body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a Service mesh client representation</summary> /// <param name="body">Create Service mesh client request with properties payload</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateServiceMeshClient(Commvault.Powershell.Models.ICreateServiceMeshReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServiceMesh" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateServiceMeshClient_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateServiceMeshClient" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateServiceMeshClient_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateServiceMeshClient" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="body">Create Service mesh client request with properties payload</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateServiceMeshClient_Validate(Commvault.Powershell.Models.ICreateServiceMeshReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create Office 365 SharePoint Online app</summary> /// <param name="body">Request Message for sharepoint app creation</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateSharepointClient(Commvault.Powershell.Models.ICreateSharepointClient body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/SharePoint" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateSharepointClient_Call (request, onOk,onConflict,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateSharepointClient" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateSharepointClient_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Conflict: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onConflict(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateSharepointClient" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Request Message for sharepoint app creation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateSharepointClient_Validate(Commvault.Powershell.Models.ICreateSharepointClient body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create Office 365 Teams app</summary> /// <param name="body">Request Message for teams app creation</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateTeamsClient(Commvault.Powershell.Models.ICreateTeamsClient body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateTeamsClient_Call (request, onOk,onConflict,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateTeamsClient" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateTeamsClient_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Conflict: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onConflict(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateTeamsClient" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Request Message for teams app creation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateTeamsClient_Validate(Commvault.Powershell.Models.ICreateTeamsClient body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a User</summary> /// <param name="body">Used to create single or multiple users.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateUser(Commvault.Powershell.Models.ICreateUsers body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateUserResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateUser_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Create a new user-group</summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateUserGroup(Commvault.Powershell.Models.ICreateUserGroup body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateUserGroup_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Create a new user-group</summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid> CreateUserGroupWithResult(Commvault.Powershell.Models.ICreateUserGroup body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateUserGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateUserGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid> CreateUserGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdNameGuid.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateUserGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateUserGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameGuid>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdNameGuid.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateUserGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateUserGroup_Validate(Commvault.Powershell.Models.ICreateUserGroup body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a User</summary> /// <param name="body">Used to create single or multiple users.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateUserResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateUserResp> CreateUserWithResult(Commvault.Powershell.Models.ICreateUsers body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateUserWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateUserWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateUserResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateUserResp> CreateUserWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateUserResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateUser" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateUser_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateUserResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateUserResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateUser" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="body">Used to create single or multiple users.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateUser_Validate(Commvault.Powershell.Models.ICreateUsers body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a Blackout Window</summary> /// <param name="body">betweenDates refers to the dates where the blackout window will be in effect. Dates have to be given /// in unix time format. time has to be provided in seconds. company refers to company to which the blackout window is associated.Id /// is given first preference if both are id and name are provided.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateV4BlackoutWindow(Commvault.Powershell.Models.IV4CreateBlackoutWindow body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateV4BlackoutWindow_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Create a Blackout Window</summary> /// <param name="body">betweenDates refers to the dates where the blackout window will be in effect. Dates have to be given /// in unix time format. time has to be provided in seconds. company refers to company to which the blackout window is associated.Id /// is given first preference if both are id and name are provided.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateV4BlackoutWindowWithResult(Commvault.Powershell.Models.IV4CreateBlackoutWindow body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreateV4BlackoutWindowWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateV4BlackoutWindowWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>" /> that will be complete when handling /// of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName> CreateV4BlackoutWindowWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreateV4BlackoutWindow" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateV4BlackoutWindow_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateV4BlackoutWindow" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">betweenDates refers to the dates where the blackout window will be in effect. Dates have to be given /// in unix time format. time has to be provided in seconds. company refers to company to which the blackout window is associated.Id /// is given first preference if both are id and name are provided.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateV4BlackoutWindow_Validate(Commvault.Powershell.Models.IV4CreateBlackoutWindow body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Create a VM Group</summary> /// <param name="body">CreatevmGroupReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateVMGroup(Commvault.Powershell.Models.ICreatevmGroupReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateVMGroupResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VMGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateVMGroup_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Create a VM Group</summary> /// <param name="body">CreatevmGroupReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreateVMGroup1(Commvault.Powershell.Models.ICreatevmGroupReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateVMGroupResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/VMGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreateVMGroup1_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreateVMGroup1" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateVMGroup1_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateVMGroupResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateVMGroupResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateVMGroup1" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">CreatevmGroupReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateVMGroup1_Validate(Commvault.Powershell.Models.ICreatevmGroupReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Actual wire call for <see cref= "CreateVMGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateVMGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateVMGroupResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateVMGroupResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreateVMGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">CreatevmGroupReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreateVMGroup_Validate(Commvault.Powershell.Models.ICreatevmGroupReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>To lock a configuration</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreatelockConfiguration(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/MMConfiguration/Lock" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreatelockConfiguration_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>To lock a configuration</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning> CreatelockConfigurationWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/MMConfiguration/Lock" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreatelockConfigurationWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "CreatelockConfigurationWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning> CreatelockConfigurationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericRespWithWarning.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreatelockConfiguration" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreatelockConfiguration_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericRespWithWarning.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreatelockConfiguration" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreatelockConfiguration_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>To unlock a configuration</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task CreatelunlockConfiguration(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/MMConfiguration/Unlock" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.CreatelunlockConfiguration_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>To unlock a configuration</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning> CreatelunlockConfigurationWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/MMConfiguration/Unlock" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.CreatelunlockConfigurationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "CreatelunlockConfigurationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning> CreatelunlockConfigurationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericRespWithWarning.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "CreatelunlockConfiguration" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreatelunlockConfiguration_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericRespWithWarning.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="CreatelunlockConfiguration" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task CreatelunlockConfiguration_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to run DDB Space Reclamation jobs on SIDB Stores associated storage pool</summary> /// <param name="storagePoolId">Id of the Storage Pool</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DdbspaceReclaimOnStoragePool(long storagePoolId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { var ddbVerificationLevel = @"DDB_DEFRAGMENTATION"; // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + (storagePoolId.ToString()) + "/DDB/SpaceReclaim" + "?" + "DDBVerificationLevel=" + global::System.Uri.EscapeDataString(ddbVerificationLevel) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DdbspaceReclaimOnStoragePool_Call (request, onOk,eventListener,sender); } } /// <summary>API to run DDB Space Reclamation jobs on SIDB Stores associated storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DdbspaceReclaimOnStoragePoolViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { var ddbVerificationLevel = @"DDB_DEFRAGMENTATION"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StoragePool/(?<storagePoolId>[^/]+)/DDB/SpaceReclaim$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StoragePool/{storagePoolId}/DDB/SpaceReclaim'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + storagePoolId + "/DDB/SpaceReclaim" + "?" + "DDBVerificationLevel=" + global::System.Uri.EscapeDataString(ddbVerificationLevel) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DdbspaceReclaimOnStoragePool_Call (request, onOk,eventListener,sender); } } /// <summary>API to run DDB Space Reclamation jobs on SIDB Stores associated storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp> DdbspaceReclaimOnStoragePoolViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { var ddbVerificationLevel = @"DDB_DEFRAGMENTATION"; // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StoragePool/(?<storagePoolId>[^/]+)/DDB/SpaceReclaim$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StoragePool/{storagePoolId}/DDB/SpaceReclaim'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + storagePoolId + "/DDB/SpaceReclaim" + "?" + "DDBVerificationLevel=" + global::System.Uri.EscapeDataString(ddbVerificationLevel) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DdbspaceReclaimOnStoragePoolWithResult_Call (request, eventListener,sender); } } /// <summary>API to run DDB Space Reclamation jobs on SIDB Stores associated storage pool</summary> /// <param name="storagePoolId">Id of the Storage Pool</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp> DdbspaceReclaimOnStoragePoolWithResult(long storagePoolId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { var ddbVerificationLevel = @"DDB_DEFRAGMENTATION"; // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + (storagePoolId.ToString()) + "/DDB/SpaceReclaim" + "?" + "DDBVerificationLevel=" + global::System.Uri.EscapeDataString(ddbVerificationLevel) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DdbspaceReclaimOnStoragePoolWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DdbspaceReclaimOnStoragePoolWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp> DdbspaceReclaimOnStoragePoolWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ArchiveCheckOperationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DdbspaceReclaimOnStoragePool" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DdbspaceReclaimOnStoragePool_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ArchiveCheckOperationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DdbspaceReclaimOnStoragePool" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="storagePoolId">Id of the Storage Pool</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DdbspaceReclaimOnStoragePool_Validate(long storagePoolId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to run DDB verification jobs on SIDB Stores associated storage pool</summary> /// <param name="storagePoolId">Id of the Storage Pool</param> /// <param name="ddbVerificationLevel">Deduplication Database and Disk Data Verification Level</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DdbverificationOnStoragePool(long storagePoolId, string ddbVerificationLevel, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + (storagePoolId.ToString()) + "/DDB/Verify" + "?" + "DDBVerificationLevel=" + global::System.Uri.EscapeDataString(ddbVerificationLevel) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DdbverificationOnStoragePool_Call (request, onOk,eventListener,sender); } } /// <summary>API to run DDB verification jobs on SIDB Stores associated storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="ddbVerificationLevel">Deduplication Database and Disk Data Verification Level</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DdbverificationOnStoragePoolViaIdentity(global::System.String viaIdentity, string ddbVerificationLevel, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StoragePool/(?<storagePoolId>[^/]+)/DDB/Verify$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StoragePool/{storagePoolId}/DDB/Verify'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + storagePoolId + "/DDB/Verify" + "?" + "DDBVerificationLevel=" + global::System.Uri.EscapeDataString(ddbVerificationLevel) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DdbverificationOnStoragePool_Call (request, onOk,eventListener,sender); } } /// <summary>API to run DDB verification jobs on SIDB Stores associated storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="ddbVerificationLevel">Deduplication Database and Disk Data Verification Level</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp> DdbverificationOnStoragePoolViaIdentityWithResult(global::System.String viaIdentity, string ddbVerificationLevel, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StoragePool/(?<storagePoolId>[^/]+)/DDB/Verify$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StoragePool/{storagePoolId}/DDB/Verify'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + storagePoolId + "/DDB/Verify" + "?" + "DDBVerificationLevel=" + global::System.Uri.EscapeDataString(ddbVerificationLevel) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DdbverificationOnStoragePoolWithResult_Call (request, eventListener,sender); } } /// <summary>API to run DDB verification jobs on SIDB Stores associated storage pool</summary> /// <param name="storagePoolId">Id of the Storage Pool</param> /// <param name="ddbVerificationLevel">Deduplication Database and Disk Data Verification Level</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp> DdbverificationOnStoragePoolWithResult(long storagePoolId, string ddbVerificationLevel, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + (storagePoolId.ToString()) + "/DDB/Verify" + "?" + "DDBVerificationLevel=" + global::System.Uri.EscapeDataString(ddbVerificationLevel) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DdbverificationOnStoragePoolWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DdbverificationOnStoragePoolWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp> DdbverificationOnStoragePoolWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ArchiveCheckOperationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DdbverificationOnStoragePool" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DdbverificationOnStoragePool_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchiveCheckOperationResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ArchiveCheckOperationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DdbverificationOnStoragePool" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="storagePoolId">Id of the Storage Pool</param> /// <param name="ddbVerificationLevel">Deduplication Database and Disk Data Verification Level</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DdbverificationOnStoragePool_Validate(long storagePoolId, string ddbVerificationLevel, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(ddbVerificationLevel),ddbVerificationLevel); } } /// <summary>Delete given tagValue for tagId</summary> /// <param name="tagId">tag id</param> /// <param name="tagValue">tag value to delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeletagValueForTagId(long tagId, string tagValue, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Tags/" + (tagId.ToString()) + "/TagValues/" + global::System.Uri.EscapeDataString(tagValue) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeletagValueForTagId_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Delete given tagValue for tagId</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeletagValueForTagIdViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Tags/(?<tagId>[^/]+)/TagValues/(?<tagValue>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Tags/{tagId}/TagValues/{tagValue}'"); } // replace URI parameters with values from identity var tagId = _match.Groups["tagId"].Value; var tagValue = _match.Groups["tagValue"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Tags/" + tagId + "/TagValues/" + tagValue ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeletagValueForTagId_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Delete given tagValue for tagId</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeletagValueForTagIdViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Tags/(?<tagId>[^/]+)/TagValues/(?<tagValue>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Tags/{tagId}/TagValues/{tagValue}'"); } // replace URI parameters with values from identity var tagId = _match.Groups["tagId"].Value; var tagValue = _match.Groups["tagValue"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Tags/" + tagId + "/TagValues/" + tagValue ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeletagValueForTagIdWithResult_Call (request, eventListener,sender); } } /// <summary>Delete given tagValue for tagId</summary> /// <param name="tagId">tag id</param> /// <param name="tagValue">tag value to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeletagValueForTagIdWithResult(long tagId, string tagValue, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Tags/" + (tagId.ToString()) + "/TagValues/" + global::System.Uri.EscapeDataString(tagValue) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeletagValueForTagIdWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeletagValueForTagIdWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeletagValueForTagIdWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeletagValueForTagId" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeletagValueForTagId_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeletagValueForTagId" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="tagId">tag id</param> /// <param name="tagValue">tag value to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeletagValueForTagId_Validate(long tagId, string tagValue, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(tagValue),tagValue); } } /// <summary>Disassociate a MediaAgent (cloud Access Path) from a bucket of a cloud storage</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="bucketId">Id of Bucket</param> /// <param name="accessPathId">Id of access path (can be fetched from GET Bucket Details API)</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteAccessPathForBucketOfCloudStorage(long cloudStorageId, long bucketId, long accessPathId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/Bucket/" + (bucketId.ToString()) + "/AccessPath/" + (accessPathId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteAccessPathForBucketOfCloudStorage_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Disassociate a MediaAgent (cloud Access Path) from a bucket of a cloud storage</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteAccessPathForBucketOfCloudStorageViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/Bucket/(?<bucketId>[^/]+)/AccessPath/(?<accessPathId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/Bucket/{bucketId}/AccessPath/{accessPathId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var bucketId = _match.Groups["bucketId"].Value; var accessPathId = _match.Groups["accessPathId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/Bucket/" + bucketId + "/AccessPath/" + accessPathId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteAccessPathForBucketOfCloudStorage_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Disassociate a MediaAgent (cloud Access Path) from a bucket of a cloud storage</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteAccessPathForBucketOfCloudStorageViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/Bucket/(?<bucketId>[^/]+)/AccessPath/(?<accessPathId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/Bucket/{bucketId}/AccessPath/{accessPathId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var bucketId = _match.Groups["bucketId"].Value; var accessPathId = _match.Groups["accessPathId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/Bucket/" + bucketId + "/AccessPath/" + accessPathId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteAccessPathForBucketOfCloudStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Disassociate a MediaAgent (cloud Access Path) from a bucket of a cloud storage</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="bucketId">Id of Bucket</param> /// <param name="accessPathId">Id of access path (can be fetched from GET Bucket Details API)</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteAccessPathForBucketOfCloudStorageWithResult(long cloudStorageId, long bucketId, long accessPathId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/Bucket/" + (bucketId.ToString()) + "/AccessPath/" + (accessPathId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteAccessPathForBucketOfCloudStorageWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteAccessPathForBucketOfCloudStorageWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteAccessPathForBucketOfCloudStorageWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "DeleteAccessPathForBucketOfCloudStorage" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteAccessPathForBucketOfCloudStorage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteAccessPathForBucketOfCloudStorage" /> method. Call this like the actual call, but /// you will get validation events back. /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="bucketId">Id of Bucket</param> /// <param name="accessPathId">Id of access path (can be fetched from GET Bucket Details API)</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteAccessPathForBucketOfCloudStorage_Validate(long cloudStorageId, long bucketId, long accessPathId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete an AD/LDAP domain</summary> /// <param name="domainId">ID of the AD/LDAP domain</param> /// <param name="transferToUserId">Optionally transfer the ownership to user</param> /// <param name="transferToUserGroupId">Optionally transfer the ownership to user group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteAdldap(long domainId, long? transferToUserId, long? transferToUserGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LDAP/" + (domainId.ToString()) + "?" + (null == transferToUserId ? global::System.String.Empty : "transferToUserId=" + global::System.Uri.EscapeDataString(transferToUserId.ToString())) + "&" + (null == transferToUserGroupId ? global::System.String.Empty : "transferToUserGroupId=" + global::System.Uri.EscapeDataString(transferToUserGroupId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteAdldap_Call (request, onOk,eventListener,sender); } } /// <summary>Delete an AD/LDAP domain</summary> /// <param name="viaIdentity"></param> /// <param name="transferToUserId">Optionally transfer the ownership to user</param> /// <param name="transferToUserGroupId">Optionally transfer the ownership to user group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteAdldapViaIdentity(global::System.String viaIdentity, long? transferToUserId, long? transferToUserGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LDAP/(?<domainId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LDAP/{domainId}'"); } // replace URI parameters with values from identity var domainId = _match.Groups["domainId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LDAP/" + domainId + "?" + (null == transferToUserId ? global::System.String.Empty : "transferToUserId=" + global::System.Uri.EscapeDataString(transferToUserId.ToString())) + "&" + (null == transferToUserGroupId ? global::System.String.Empty : "transferToUserGroupId=" + global::System.Uri.EscapeDataString(transferToUserGroupId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteAdldap_Call (request, onOk,eventListener,sender); } } /// <summary>Delete an AD/LDAP domain</summary> /// <param name="viaIdentity"></param> /// <param name="transferToUserId">Optionally transfer the ownership to user</param> /// <param name="transferToUserGroupId">Optionally transfer the ownership to user group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteAdldapViaIdentityWithResult(global::System.String viaIdentity, long? transferToUserId, long? transferToUserGroupId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LDAP/(?<domainId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LDAP/{domainId}'"); } // replace URI parameters with values from identity var domainId = _match.Groups["domainId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LDAP/" + domainId + "?" + (null == transferToUserId ? global::System.String.Empty : "transferToUserId=" + global::System.Uri.EscapeDataString(transferToUserId.ToString())) + "&" + (null == transferToUserGroupId ? global::System.String.Empty : "transferToUserGroupId=" + global::System.Uri.EscapeDataString(transferToUserGroupId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteAdldapWithResult_Call (request, eventListener,sender); } } /// <summary>Delete an AD/LDAP domain</summary> /// <param name="domainId">ID of the AD/LDAP domain</param> /// <param name="transferToUserId">Optionally transfer the ownership to user</param> /// <param name="transferToUserGroupId">Optionally transfer the ownership to user group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteAdldapWithResult(long domainId, long? transferToUserId, long? transferToUserGroupId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LDAP/" + (domainId.ToString()) + "?" + (null == transferToUserId ? global::System.String.Empty : "transferToUserId=" + global::System.Uri.EscapeDataString(transferToUserId.ToString())) + "&" + (null == transferToUserGroupId ? global::System.String.Empty : "transferToUserGroupId=" + global::System.Uri.EscapeDataString(transferToUserGroupId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteAdldapWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteAdldapWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteAdldapWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteAdldap" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteAdldap_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteAdldap" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="domainId">ID of the AD/LDAP domain</param> /// <param name="transferToUserId">Optionally transfer the ownership to user</param> /// <param name="transferToUserGroupId">Optionally transfer the ownership to user group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteAdldap_Validate(long domainId, long? transferToUserId, long? transferToUserGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// Used to delete an agent from a server /// It is expected that the agent has been deconfigured before performing delete operation. /// But internally if the agent is not deconfigured, then we force deconfigure it to proceed with delete operation /// Examples of supported agentIds are: /// 33-File System, /// 106-Virtual Server /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteAgent(long serverId, long agentId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Agent/" + (agentId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteAgent_Call (request, onOk,eventListener,sender); } } /// <summary> /// Used to delete an agent from a server /// It is expected that the agent has been deconfigured before performing delete operation. /// But internally if the agent is not deconfigured, then we force deconfigure it to proceed with delete operation /// Examples of supported agentIds are: /// 33-File System, /// 106-Virtual Server /// </summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteAgentViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Agent/(?<agentId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Agent/{agentId}'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; var agentId = _match.Groups["agentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Agent/" + agentId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteAgent_Call (request, onOk,eventListener,sender); } } /// <summary> /// Used to delete an agent from a server /// It is expected that the agent has been deconfigured before performing delete operation. /// But internally if the agent is not deconfigured, then we force deconfigure it to proceed with delete operation /// Examples of supported agentIds are: /// 33-File System, /// 106-Virtual Server /// </summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteAgentViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Agent/(?<agentId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Agent/{agentId}'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; var agentId = _match.Groups["agentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Agent/" + agentId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteAgentWithResult_Call (request, eventListener,sender); } } /// <summary> /// Used to delete an agent from a server /// It is expected that the agent has been deconfigured before performing delete operation. /// But internally if the agent is not deconfigured, then we force deconfigure it to proceed with delete operation /// Examples of supported agentIds are: /// 33-File System, /// 106-Virtual Server /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteAgentWithResult(long serverId, long agentId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Agent/" + (agentId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteAgentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteAgentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteAgentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteAgent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteAgent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteAgent" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteAgent_Validate(long serverId, long agentId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete the alert custom rule by using the given alert rule id</summary> /// <param name="alertRuleId">Unique Id of the alert custom rule to delete it</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteAlertCustomRule(long alertRuleId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + (alertRuleId.ToString()) + "/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteAlertCustomRule_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Delete the alert custom rule by using the given alert rule id</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteAlertCustomRuleViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/Alert/CustomRule/(?<alertRuleId>[^/]+)/Delete$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/Alert/CustomRule/{alertRuleId}/Delete'"); } // replace URI parameters with values from identity var alertRuleId = _match.Groups["alertRuleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + alertRuleId + "/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteAlertCustomRule_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Delete the alert custom rule by using the given alert rule id</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp> DeleteAlertCustomRuleViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/Alert/CustomRule/(?<alertRuleId>[^/]+)/Delete$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/Alert/CustomRule/{alertRuleId}/Delete'"); } // replace URI parameters with values from identity var alertRuleId = _match.Groups["alertRuleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + alertRuleId + "/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteAlertCustomRuleWithResult_Call (request, eventListener,sender); } } /// <summary>Delete the alert custom rule by using the given alert rule id</summary> /// <param name="alertRuleId">Unique Id of the alert custom rule to delete it</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp> DeleteAlertCustomRuleWithResult(long alertRuleId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + (alertRuleId.ToString()) + "/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteAlertCustomRuleWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteAlertCustomRuleWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp> DeleteAlertCustomRuleWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertRuleGenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteAlertCustomRule" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteAlertCustomRule_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertRuleGenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteAlertCustomRule" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="alertRuleId">Unique Id of the alert custom rule to delete it</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteAlertCustomRule_Validate(long alertRuleId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete alert definitions</summary> /// <param name="id"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteAlertDefinitions(long id, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + (id.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteAlertDefinitions_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Delete alert definitions</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteAlertDefinitionsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AlertDefinitions/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AlertDefinitions/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + id ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteAlertDefinitions_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Delete alert definitions</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteAlertDefinitionsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AlertDefinitions/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AlertDefinitions/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + id ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteAlertDefinitionsWithResult_Call (request, eventListener,sender); } } /// <summary>Delete alert definitions</summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteAlertDefinitionsWithResult(long id, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + (id.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteAlertDefinitionsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteAlertDefinitionsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteAlertDefinitionsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteAlertDefinitions" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteAlertDefinitions_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteAlertDefinitions" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteAlertDefinitions_Validate(long id, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteArchiveBackupDestination(long planId, long backupDestinationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteArchiveBackupDestination_Call (request, onOk,onNotFound,onPreconditionFailed,onInternalServerError,eventListener,sender); } } /// <summary>Delete Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteArchiveBackupDestinationViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteArchiveBackupDestination_Call (request, onOk,onNotFound,onPreconditionFailed,onInternalServerError,eventListener,sender); } } /// <summary>Delete Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteArchiveBackupDestinationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteArchiveBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary>Delete Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteArchiveBackupDestinationWithResult(long planId, long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteArchiveBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteArchiveBackupDestinationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteArchiveBackupDestinationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.PreconditionFailed: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteArchiveBackupDestination" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteArchiveBackupDestination_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.PreconditionFailed: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onPreconditionFailed(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteArchiveBackupDestination" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteArchiveBackupDestination_Validate(long planId, long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete existing archive plan</summary> /// <param name="planId">Id of the plan</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteArchivePlanById(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteArchivePlanById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Delete existing archive plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteArchivePlanByIdViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteArchivePlanById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Delete existing archive plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteArchivePlanByIdViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteArchivePlanByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Delete existing archive plan</summary> /// <param name="planId">Id of the plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteArchivePlanByIdWithResult(long planId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteArchivePlanByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteArchivePlanByIdWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteArchivePlanByIdWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteArchivePlanById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteArchivePlanById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteArchivePlanById" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteArchivePlanById_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Deleting a Storage Array</summary> /// <param name="arrayId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteArray(long arrayId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteArray_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Deleting a Storage Array</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteArrayViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteArray_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Deleting a Storage Array</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteArrayViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteArrayWithResult_Call (request, eventListener,sender); } } /// <summary>Deleting a Storage Array</summary> /// <param name="arrayId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteArrayWithResult(long arrayId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteArrayWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteArrayWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteArrayWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteArray" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteArray_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteArray" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="arrayId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteArray_Validate(long arrayId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteBackupDestination(long planId, long backupDestinationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteBackupDestination_Call (request, onOk,onNotFound,onPreconditionFailed,onInternalServerError,eventListener,sender); } } /// <summary>Delete Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteBackupDestinationViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteBackupDestination_Call (request, onOk,onNotFound,onPreconditionFailed,onInternalServerError,eventListener,sender); } } /// <summary>Delete Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBackupDestinationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary>Delete Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBackupDestinationWithResult(long planId, long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteBackupDestinationWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBackupDestinationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.PreconditionFailed: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Delete Backup Destination. If trying to delete primary backup destination which is not associated with any plan, it will /// delete all secondary copies also. /// </summary> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteBackupDestinationWithoutPlanInfo(long backupDestinationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteBackupDestinationWithoutPlanInfo_Call (request, onOk,onNotFound,onPreconditionFailed,onInternalServerError,eventListener,sender); } } /// <summary> /// Delete Backup Destination. If trying to delete primary backup destination which is not associated with any plan, it will /// delete all secondary copies also. /// </summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteBackupDestinationWithoutPlanInfoViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteBackupDestinationWithoutPlanInfo_Call (request, onOk,onNotFound,onPreconditionFailed,onInternalServerError,eventListener,sender); } } /// <summary> /// Delete Backup Destination. If trying to delete primary backup destination which is not associated with any plan, it will /// delete all secondary copies also. /// </summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBackupDestinationWithoutPlanInfoViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteBackupDestinationWithoutPlanInfoWithResult_Call (request, eventListener,sender); } } /// <summary> /// Delete Backup Destination. If trying to delete primary backup destination which is not associated with any plan, it will /// delete all secondary copies also. /// </summary> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBackupDestinationWithoutPlanInfoWithResult(long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteBackupDestinationWithoutPlanInfoWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteBackupDestinationWithoutPlanInfoWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBackupDestinationWithoutPlanInfoWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.PreconditionFailed: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "DeleteBackupDestinationWithoutPlanInfo" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteBackupDestinationWithoutPlanInfo_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.PreconditionFailed: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onPreconditionFailed(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteBackupDestinationWithoutPlanInfo" /> method. Call this like the actual call, but /// you will get validation events back. /// </summary> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteBackupDestinationWithoutPlanInfo_Validate(long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Actual wire call for <see cref= "DeleteBackupDestination" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteBackupDestination_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.PreconditionFailed: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onPreconditionFailed(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteBackupDestination" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteBackupDestination_Validate(long planId, long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Modify the properties of an existing mount path</summary> /// <param name="storagePoolId">Id of the disk storage to whose backup location has to be deleted</param> /// <param name="backupLocationId">Id of the backup location to delete</param> /// <param name="forceDelete">Force deletes a backup location.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteBackupLocation(long storagePoolId, long backupLocationId, bool? forceDelete, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "?" + (null == forceDelete ? global::System.String.Empty : "forceDelete=" + global::System.Uri.EscapeDataString(forceDelete.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteBackupLocation_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing mount path</summary> /// <param name="viaIdentity"></param> /// <param name="forceDelete">Force deletes a backup location.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteBackupLocationViaIdentity(global::System.String viaIdentity, bool? forceDelete, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation/{backupLocationId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation/" + backupLocationId + "?" + (null == forceDelete ? global::System.String.Empty : "forceDelete=" + global::System.Uri.EscapeDataString(forceDelete.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteBackupLocation_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing mount path</summary> /// <param name="viaIdentity"></param> /// <param name="forceDelete">Force deletes a backup location.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBackupLocationViaIdentityWithResult(global::System.String viaIdentity, bool? forceDelete, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation/{backupLocationId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation/" + backupLocationId + "?" + (null == forceDelete ? global::System.String.Empty : "forceDelete=" + global::System.Uri.EscapeDataString(forceDelete.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteBackupLocationWithResult_Call (request, eventListener,sender); } } /// <summary>Modify the properties of an existing mount path</summary> /// <param name="storagePoolId">Id of the disk storage to whose backup location has to be deleted</param> /// <param name="backupLocationId">Id of the backup location to delete</param> /// <param name="forceDelete">Force deletes a backup location.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBackupLocationWithResult(long storagePoolId, long backupLocationId, bool? forceDelete, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "?" + (null == forceDelete ? global::System.String.Empty : "forceDelete=" + global::System.Uri.EscapeDataString(forceDelete.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteBackupLocationWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteBackupLocationWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBackupLocationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteBackupLocation" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteBackupLocation_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteBackupLocation" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the disk storage to whose backup location has to be deleted</param> /// <param name="backupLocationId">Id of the backup location to delete</param> /// <param name="forceDelete">Force deletes a backup location.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteBackupLocation_Validate(long storagePoolId, long backupLocationId, bool? forceDelete, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete a Blackout Window</summary> /// <param name="blackoutWindowId">Id of the Blackout Window to delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteBlackoutWindow(long blackoutWindowId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow/" + (blackoutWindowId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteBlackoutWindow_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a Blackout Window</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteBlackoutWindowViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/BlackoutWindow/(?<blackoutWindowId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/BlackoutWindow/{blackoutWindowId}'"); } // replace URI parameters with values from identity var blackoutWindowId = _match.Groups["blackoutWindowId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow/" + blackoutWindowId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteBlackoutWindow_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a Blackout Window</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBlackoutWindowViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/BlackoutWindow/(?<blackoutWindowId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/BlackoutWindow/{blackoutWindowId}'"); } // replace URI parameters with values from identity var blackoutWindowId = _match.Groups["blackoutWindowId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow/" + blackoutWindowId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteBlackoutWindowWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete a Blackout Window</summary> /// <param name="blackoutWindowId">Id of the Blackout Window to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBlackoutWindowWithResult(long blackoutWindowId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow/" + (blackoutWindowId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteBlackoutWindowWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteBlackoutWindowWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBlackoutWindowWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteBlackoutWindow" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteBlackoutWindow_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteBlackoutWindow" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="blackoutWindowId">Id of the Blackout Window to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteBlackoutWindow_Validate(long blackoutWindowId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete the specified bucket of the cloud storage</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="bucketId">Id of Bucket</param> /// <param name="forceDelete">Force deletes the bucket when physical deletion of data not possible. It will do DB cleanup /// only.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteBucketOfCloudStorage(long cloudStorageId, long bucketId, bool? forceDelete, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/Bucket/" + (bucketId.ToString()) + "?" + (null == forceDelete ? global::System.String.Empty : "forceDelete=" + global::System.Uri.EscapeDataString(forceDelete.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteBucketOfCloudStorage_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Delete the specified bucket of the cloud storage</summary> /// <param name="viaIdentity"></param> /// <param name="forceDelete">Force deletes the bucket when physical deletion of data not possible. It will do DB cleanup /// only.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteBucketOfCloudStorageViaIdentity(global::System.String viaIdentity, bool? forceDelete, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/Bucket/(?<bucketId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/Bucket/{bucketId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var bucketId = _match.Groups["bucketId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/Bucket/" + bucketId + "?" + (null == forceDelete ? global::System.String.Empty : "forceDelete=" + global::System.Uri.EscapeDataString(forceDelete.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteBucketOfCloudStorage_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Delete the specified bucket of the cloud storage</summary> /// <param name="viaIdentity"></param> /// <param name="forceDelete">Force deletes the bucket when physical deletion of data not possible. It will do DB cleanup /// only.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBucketOfCloudStorageViaIdentityWithResult(global::System.String viaIdentity, bool? forceDelete, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/Bucket/(?<bucketId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/Bucket/{bucketId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var bucketId = _match.Groups["bucketId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/Bucket/" + bucketId + "?" + (null == forceDelete ? global::System.String.Empty : "forceDelete=" + global::System.Uri.EscapeDataString(forceDelete.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteBucketOfCloudStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Delete the specified bucket of the cloud storage</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="bucketId">Id of Bucket</param> /// <param name="forceDelete">Force deletes the bucket when physical deletion of data not possible. It will do DB cleanup /// only.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBucketOfCloudStorageWithResult(long cloudStorageId, long bucketId, bool? forceDelete, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/Bucket/" + (bucketId.ToString()) + "?" + (null == forceDelete ? global::System.String.Empty : "forceDelete=" + global::System.Uri.EscapeDataString(forceDelete.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteBucketOfCloudStorageWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteBucketOfCloudStorageWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBucketOfCloudStorageWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteBucketOfCloudStorage" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteBucketOfCloudStorage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteBucketOfCloudStorage" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="bucketId">Id of Bucket</param> /// <param name="forceDelete">Force deletes the bucket when physical deletion of data not possible. It will do DB cleanup /// only.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteBucketOfCloudStorage_Validate(long cloudStorageId, long bucketId, bool? forceDelete, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API is used to delete multiple laptopowner mappings</summary> /// <param name="body">List of laptop owner mappings ids which needs to be deleted</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteBulkLaptopOwnerMappingActionDelete(Commvault.Powershell.Models.IDeleteLaptopOwnerMapping body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopOwnerMapping/action/delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteBulkLaptopOwnerMappingActionDelete_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>API is used to delete multiple laptopowner mappings</summary> /// <param name="body">List of laptop owner mappings ids which needs to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBulkLaptopOwnerMappingActionDeleteWithResult(Commvault.Powershell.Models.IDeleteLaptopOwnerMapping body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopOwnerMapping/action/delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteBulkLaptopOwnerMappingActionDeleteWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteBulkLaptopOwnerMappingActionDeleteWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteBulkLaptopOwnerMappingActionDeleteWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "DeleteBulkLaptopOwnerMappingActionDelete" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteBulkLaptopOwnerMappingActionDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteBulkLaptopOwnerMappingActionDelete" /> method. Call this like the actual call, /// but you will get validation events back. /// </summary> /// <param name="body">List of laptop owner mappings ids which needs to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteBulkLaptopOwnerMappingActionDelete_Validate(Commvault.Powershell.Models.IDeleteLaptopOwnerMapping body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Delete existing cloud storage</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteCloudStorageById(long cloudStorageId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteCloudStorageById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Delete existing cloud storage</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteCloudStorageByIdViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteCloudStorageById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Delete existing cloud storage</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCloudStorageByIdViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteCloudStorageByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Delete existing cloud storage</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCloudStorageByIdWithResult(long cloudStorageId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteCloudStorageByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteCloudStorageByIdWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCloudStorageByIdWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteCloudStorageById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteCloudStorageById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteCloudStorageById" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteCloudStorageById_Validate(long cloudStorageId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete metadata cache of an existing cloud storage</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="metadataCacheId">Id of metadata cache</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteCloudStorageMetadataCacheById(long cloudStorageId, long metadataCacheId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/MetadataCache/" + (metadataCacheId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteCloudStorageMetadataCacheById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Delete metadata cache of an existing cloud storage</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteCloudStorageMetadataCacheByIdViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/MetadataCache/(?<metadataCacheId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/MetadataCache/{metadataCacheId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var metadataCacheId = _match.Groups["metadataCacheId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/MetadataCache/" + metadataCacheId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteCloudStorageMetadataCacheById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Delete metadata cache of an existing cloud storage</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCloudStorageMetadataCacheByIdViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/MetadataCache/(?<metadataCacheId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/MetadataCache/{metadataCacheId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var metadataCacheId = _match.Groups["metadataCacheId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/MetadataCache/" + metadataCacheId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteCloudStorageMetadataCacheByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Delete metadata cache of an existing cloud storage</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="metadataCacheId">Id of metadata cache</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCloudStorageMetadataCacheByIdWithResult(long cloudStorageId, long metadataCacheId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/MetadataCache/" + (metadataCacheId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteCloudStorageMetadataCacheByIdWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteCloudStorageMetadataCacheByIdWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCloudStorageMetadataCacheByIdWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "DeleteCloudStorageMetadataCacheById" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteCloudStorageMetadataCacheById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteCloudStorageMetadataCacheById" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="metadataCacheId">Id of metadata cache</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteCloudStorageMetadataCacheById_Validate(long cloudStorageId, long metadataCacheId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete a company which has been deactivated</summary> /// <param name="companyId">Id of the company to delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteCompany(long companyId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company/" + (companyId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteCompany_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a company which has been deactivated</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteCompanyViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/company/(?<companyId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/company/{companyId}'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company/" + companyId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteCompany_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a company which has been deactivated</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCompanyViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/company/(?<companyId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/company/{companyId}'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company/" + companyId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteCompanyWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete a company which has been deactivated</summary> /// <param name="companyId">Id of the company to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCompanyWithResult(long companyId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company/" + (companyId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteCompanyWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteCompanyWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCompanyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteCompany" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteCompany_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteCompany" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="companyId">Id of the company to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteCompany_Validate(long companyId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete Credential whose id has been provided</summary> /// <param name="credentialId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteCredential(string credentialId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Credential/" + global::System.Uri.EscapeDataString(credentialId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteCredential_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Delete Credential whose name has been provided</summary> /// <param name="credentialName"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteCredentialByName(string credentialName, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Credential/" + global::System.Uri.EscapeDataString(credentialName) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteCredentialByName_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Delete Credential whose name has been provided</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteCredentialByNameViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Credential/(?<credentialName>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Credential/{credentialName}'"); } // replace URI parameters with values from identity var credentialName = _match.Groups["credentialName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Credential/" + credentialName ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteCredentialByName_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Delete Credential whose name has been provided</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCredentialByNameViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Credential/(?<credentialName>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Credential/{credentialName}'"); } // replace URI parameters with values from identity var credentialName = _match.Groups["credentialName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Credential/" + credentialName ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteCredentialByNameWithResult_Call (request, eventListener,sender); } } /// <summary>Delete Credential whose name has been provided</summary> /// <param name="credentialName"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCredentialByNameWithResult(string credentialName, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Credential/" + global::System.Uri.EscapeDataString(credentialName) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteCredentialByNameWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteCredentialByNameWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCredentialByNameWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteCredentialByName" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteCredentialByName_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteCredentialByName" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="credentialName"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteCredentialByName_Validate(string credentialName, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(credentialName),credentialName); } } /// <summary>Delete Credential whose id has been provided</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteCredentialViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Credential/(?<credentialId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Credential/{credentialId}'"); } // replace URI parameters with values from identity var credentialId = _match.Groups["credentialId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Credential/" + credentialId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteCredential_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Delete Credential whose id has been provided</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCredentialViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Credential/(?<credentialId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Credential/{credentialId}'"); } // replace URI parameters with values from identity var credentialId = _match.Groups["credentialId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Credential/" + credentialId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteCredentialWithResult_Call (request, eventListener,sender); } } /// <summary>Delete Credential whose id has been provided</summary> /// <param name="credentialId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCredentialWithResult(string credentialId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Credential/" + global::System.Uri.EscapeDataString(credentialId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteCredentialWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteCredentialWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteCredentialWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteCredential" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteCredential_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteCredential" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="credentialId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteCredential_Validate(string credentialId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(credentialId),credentialId); } } /// <summary>Used to delete an existing CVFS S3 Bucket</summary> /// <param name="id">ID of the bucket</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteCvfsS3Bucket(long id, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + (id.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteCvfsS3Bucket_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete an existing CVFS S3 Bucket</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteCvfsS3BucketViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CVFS/S3Bucket/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CVFS/S3Bucket/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + id ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteCvfsS3Bucket_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete an existing CVFS S3 Bucket</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> DeleteCvfsS3BucketViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CVFS/S3Bucket/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CVFS/S3Bucket/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + id ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteCvfsS3BucketWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete an existing CVFS S3 Bucket</summary> /// <param name="id">ID of the bucket</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> DeleteCvfsS3BucketWithResult(long id, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + (id.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteCvfsS3BucketWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteCvfsS3BucketWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> DeleteCvfsS3BucketWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteCvfsS3Bucket" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteCvfsS3Bucket_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteCvfsS3Bucket" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id">ID of the bucket</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteCvfsS3Bucket_Validate(long id, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete an existing data classification plan</summary> /// <param name="planId">Id of the plan to fetch details</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteDcPlan(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DCPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteDcPlan_Call (request, onOk,onBadRequest,onForbidden,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete an existing data classification plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteDcPlanViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/DCPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/DCPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DCPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteDcPlan_Call (request, onOk,onBadRequest,onForbidden,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete an existing data classification plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDcPlanViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/DCPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/DCPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DCPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteDcPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete an existing data classification plan</summary> /// <param name="planId">Id of the plan to fetch details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDcPlanWithResult(long planId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DCPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteDcPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteDcPlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDcPlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteDcPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteDcPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteDcPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the plan to fetch details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteDcPlan_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to delete a deconfigured Kubernetes cluster with clusterId</summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteDeconfiguredKubernetesCluster(long clusterId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + (clusterId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteDeconfiguredKubernetesCluster_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to delete a deconfigured Kubernetes cluster with clusterId</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteDeconfiguredKubernetesClusterViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Cluster/(?<clusterId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Cluster/{clusterId}'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + clusterId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteDeconfiguredKubernetesCluster_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to delete a deconfigured Kubernetes cluster with clusterId</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDeconfiguredKubernetesClusterViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Cluster/(?<clusterId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Cluster/{clusterId}'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + clusterId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteDeconfiguredKubernetesClusterWithResult_Call (request, eventListener,sender); } } /// <summary>API to delete a deconfigured Kubernetes cluster with clusterId</summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDeconfiguredKubernetesClusterWithResult(long clusterId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + (clusterId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteDeconfiguredKubernetesClusterWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteDeconfiguredKubernetesClusterWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDeconfiguredKubernetesClusterWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "DeleteDeconfiguredKubernetesCluster" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteDeconfiguredKubernetesCluster_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteDeconfiguredKubernetesCluster" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteDeconfiguredKubernetesCluster_Validate(long clusterId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete a media agent to a disk access path</summary> /// <param name="storagePoolId">Id of the disk storage pool whose access path has to be deleted</param> /// <param name="backupLocationId">Id of the mount path whose access path has to be deleted</param> /// <param name="accessPathId">Id of the mount path whose access path has to be deleted</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteDiskAccessPath(long storagePoolId, long backupLocationId, long accessPathId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath/" + (accessPathId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteDiskAccessPath_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to delete a media agent to a disk access path</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteDiskAccessPathViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath/(?<accessPathId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath/{accessPathId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; var accessPathId = _match.Groups["accessPathId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath/" + accessPathId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteDiskAccessPath_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to delete a media agent to a disk access path</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDiskAccessPathViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath/(?<accessPathId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath/{accessPathId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; var accessPathId = _match.Groups["accessPathId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath/" + accessPathId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteDiskAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete a media agent to a disk access path</summary> /// <param name="storagePoolId">Id of the disk storage pool whose access path has to be deleted</param> /// <param name="backupLocationId">Id of the mount path whose access path has to be deleted</param> /// <param name="accessPathId">Id of the mount path whose access path has to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDiskAccessPathWithResult(long storagePoolId, long backupLocationId, long accessPathId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath/" + (accessPathId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteDiskAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteDiskAccessPathWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDiskAccessPathWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteDiskAccessPath" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteDiskAccessPath_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteDiskAccessPath" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the disk storage pool whose access path has to be deleted</param> /// <param name="backupLocationId">Id of the mount path whose access path has to be deleted</param> /// <param name="accessPathId">Id of the mount path whose access path has to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteDiskAccessPath_Validate(long storagePoolId, long backupLocationId, long accessPathId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete a disk storage pool</summary> /// <param name="storagePoolId">Id of the disk storage pool to delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteDiskStorage(long storagePoolId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteDiskStorage_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a disk storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteDiskStorageViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteDiskStorage_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a disk storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDiskStorageViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteDiskStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete a disk storage pool</summary> /// <param name="storagePoolId">Id of the disk storage pool to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDiskStorageWithResult(long storagePoolId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteDiskStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteDiskStorageWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDiskStorageWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteDiskStorage" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteDiskStorage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteDiskStorage" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the disk storage pool to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteDiskStorage_Validate(long storagePoolId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete DR Backup Destination for Commserve DR backup</summary> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteDrBackupDestination(long backupDestinationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DRBackup/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteDrBackupDestination_Call (request, onOk,onNotFound,onPreconditionFailed,onInternalServerError,eventListener,sender); } } /// <summary>Delete DR Backup Destination for Commserve DR backup</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteDrBackupDestinationViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/DRBackup/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/DRBackup/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DRBackup/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteDrBackupDestination_Call (request, onOk,onNotFound,onPreconditionFailed,onInternalServerError,eventListener,sender); } } /// <summary>Delete DR Backup Destination for Commserve DR backup</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDrBackupDestinationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/DRBackup/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/DRBackup/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DRBackup/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteDrBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary>Delete DR Backup Destination for Commserve DR backup</summary> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDrBackupDestinationWithResult(long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DRBackup/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteDrBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteDrBackupDestinationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteDrBackupDestinationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.PreconditionFailed: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteDrBackupDestination" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteDrBackupDestination_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.PreconditionFailed: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onPreconditionFailed(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteDrBackupDestination" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteDrBackupDestination_Validate(long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete tag from the entity tag list</summary> /// <param name="tagId">Id of the tag to delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteEntityTag(long tagId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EntityTags/" + (tagId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteEntityTag_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Used to delete tag from the entity tag list</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteEntityTagViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/EntityTags/(?<tagId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/EntityTags/{tagId}'"); } // replace URI parameters with values from identity var tagId = _match.Groups["tagId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EntityTags/" + tagId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteEntityTag_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Used to delete tag from the entity tag list</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteEntityTagViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/EntityTags/(?<tagId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/EntityTags/{tagId}'"); } // replace URI parameters with values from identity var tagId = _match.Groups["tagId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EntityTags/" + tagId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteEntityTagWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete tag from the entity tag list</summary> /// <param name="tagId">Id of the tag to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteEntityTagWithResult(long tagId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EntityTags/" + (tagId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteEntityTagWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteEntityTagWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteEntityTagWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteEntityTag" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteEntityTag_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteEntityTag" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="tagId">Id of the tag to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteEntityTag_Validate(long tagId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to delete failover group</summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteFailoverGroup(long failoverGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + (failoverGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteFailoverGroup_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>API to delete failover group DR operation schedule</summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="scheduleId">ID of the DR operation schedule</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteFailoverGroupSchedule(long failoverGroupId, long scheduleId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + (failoverGroupId.ToString()) + "/Schedules/" + (scheduleId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteFailoverGroupSchedule_Call (request, onOk,onBadRequest,onServiceUnavailable,eventListener,sender); } } /// <summary>API to delete failover group DR operation schedule</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteFailoverGroupScheduleViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/FailoverGroups/(?<failoverGroupId>[^/]+)/Schedules/(?<scheduleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/FailoverGroups/{failoverGroupId}/Schedules/{scheduleId}'"); } // replace URI parameters with values from identity var failoverGroupId = _match.Groups["failoverGroupId"].Value; var scheduleId = _match.Groups["scheduleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + failoverGroupId + "/Schedules/" + scheduleId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteFailoverGroupSchedule_Call (request, onOk,onBadRequest,onServiceUnavailable,eventListener,sender); } } /// <summary>API to delete failover group DR operation schedule</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteFailoverGroupScheduleViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/FailoverGroups/(?<failoverGroupId>[^/]+)/Schedules/(?<scheduleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/FailoverGroups/{failoverGroupId}/Schedules/{scheduleId}'"); } // replace URI parameters with values from identity var failoverGroupId = _match.Groups["failoverGroupId"].Value; var scheduleId = _match.Groups["scheduleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + failoverGroupId + "/Schedules/" + scheduleId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteFailoverGroupScheduleWithResult_Call (request, eventListener,sender); } } /// <summary>API to delete failover group DR operation schedule</summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="scheduleId">ID of the DR operation schedule</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteFailoverGroupScheduleWithResult(long failoverGroupId, long scheduleId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + (failoverGroupId.ToString()) + "/Schedules/" + (scheduleId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteFailoverGroupScheduleWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteFailoverGroupScheduleWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteFailoverGroupScheduleWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteFailoverGroupSchedule" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteFailoverGroupSchedule_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteFailoverGroupSchedule" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="scheduleId">ID of the DR operation schedule</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteFailoverGroupSchedule_Validate(long failoverGroupId, long scheduleId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to delete failover group</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteFailoverGroupViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/FailoverGroups/(?<failoverGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/FailoverGroups/{failoverGroupId}'"); } // replace URI parameters with values from identity var failoverGroupId = _match.Groups["failoverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + failoverGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteFailoverGroup_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>API to delete failover group</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteFailoverGroupViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/FailoverGroups/(?<failoverGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/FailoverGroups/{failoverGroupId}'"); } // replace URI parameters with values from identity var failoverGroupId = _match.Groups["failoverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + failoverGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteFailoverGroupWithResult_Call (request, eventListener,sender); } } /// <summary>API to delete failover group</summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteFailoverGroupWithResult(long failoverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + (failoverGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteFailoverGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteFailoverGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteFailoverGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteFailoverGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteFailoverGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteFailoverGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteFailoverGroup_Validate(long failoverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>This endpoint is used to delete network topology.</summary> /// <param name="topologyId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteFirewallTopology(string topologyId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology/" + global::System.Uri.EscapeDataString(topologyId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteFirewallTopology_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>This endpoint is used to delete network topology.</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteFirewallTopologyViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/NetworkTopology/(?<topologyId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/NetworkTopology/{topologyId}'"); } // replace URI parameters with values from identity var topologyId = _match.Groups["topologyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology/" + topologyId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteFirewallTopology_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>This endpoint is used to delete network topology.</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteFirewallTopologyViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/NetworkTopology/(?<topologyId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/NetworkTopology/{topologyId}'"); } // replace URI parameters with values from identity var topologyId = _match.Groups["topologyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology/" + topologyId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteFirewallTopologyWithResult_Call (request, eventListener,sender); } } /// <summary>This endpoint is used to delete network topology.</summary> /// <param name="topologyId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteFirewallTopologyWithResult(string topologyId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology/" + global::System.Uri.EscapeDataString(topologyId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteFirewallTopologyWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteFirewallTopologyWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteFirewallTopologyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteFirewallTopology" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteFirewallTopology_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteFirewallTopology" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="topologyId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteFirewallTopology_Validate(string topologyId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(topologyId),topologyId); } } /// <summary>Delete existing hyperscale storage</summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteHyperScaleStorageById(long hyperScaleStorageId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + (hyperScaleStorageId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteHyperScaleStorageById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Delete existing hyperscale storage</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteHyperScaleStorageByIdViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/HyperScale/(?<hyperScaleStorageId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/HyperScale/{hyperScaleStorageId}'"); } // replace URI parameters with values from identity var hyperScaleStorageId = _match.Groups["hyperScaleStorageId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + hyperScaleStorageId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteHyperScaleStorageById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Delete existing hyperscale storage</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteHyperScaleStorageByIdViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/HyperScale/(?<hyperScaleStorageId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/HyperScale/{hyperScaleStorageId}'"); } // replace URI parameters with values from identity var hyperScaleStorageId = _match.Groups["hyperScaleStorageId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + hyperScaleStorageId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteHyperScaleStorageByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Delete existing hyperscale storage</summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteHyperScaleStorageByIdWithResult(long hyperScaleStorageId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + (hyperScaleStorageId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteHyperScaleStorageByIdWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteHyperScaleStorageByIdWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteHyperScaleStorageByIdWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteHyperScaleStorageById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteHyperScaleStorageById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteHyperScaleStorageById" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteHyperScaleStorageById_Validate(long hyperScaleStorageId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>delete an existing Hypervisor</summary> /// <param name="hypervisorId">Id of the Hypervisor to delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteHypervisor(long hypervisorId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + (hypervisorId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteHypervisor_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>delete an existing Hypervisor</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteHypervisorViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Hypervisor/(?<hypervisorId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Hypervisor/{hypervisorId}'"); } // replace URI parameters with values from identity var hypervisorId = _match.Groups["hypervisorId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + hypervisorId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteHypervisor_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>delete an existing Hypervisor</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteHypervisorViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Hypervisor/(?<hypervisorId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Hypervisor/{hypervisorId}'"); } // replace URI parameters with values from identity var hypervisorId = _match.Groups["hypervisorId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + hypervisorId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteHypervisorWithResult_Call (request, eventListener,sender); } } /// <summary>delete an existing Hypervisor</summary> /// <param name="hypervisorId">Id of the Hypervisor to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteHypervisorWithResult(long hypervisorId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + (hypervisorId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteHypervisorWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteHypervisorWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteHypervisorWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteHypervisor" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteHypervisor_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteHypervisor" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="hypervisorId">Id of the Hypervisor to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteHypervisor_Validate(long hypervisorId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Deleting an inventory</summary> /// <param name="inventoryId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteInventory(long inventoryId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + (inventoryId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteInventory_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Delete the inventory asset</summary> /// <param name="inventoryId"></param> /// <param name="assetId">FQDN of the asset</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteInventoryAsset(long inventoryId, string assetId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + (inventoryId.ToString()) + "/Assets/" + global::System.Uri.EscapeDataString(assetId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteInventoryAsset_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Delete the inventory asset</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteInventoryAssetViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/InventoryManager/Inventory/(?<inventoryId>[^/]+)/Assets/(?<assetId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/InventoryManager/Inventory/{inventoryId}/Assets/{assetId}'"); } // replace URI parameters with values from identity var inventoryId = _match.Groups["inventoryId"].Value; var assetId = _match.Groups["assetId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + inventoryId + "/Assets/" + assetId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteInventoryAsset_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Delete the inventory asset</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteInventoryAssetViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/InventoryManager/Inventory/(?<inventoryId>[^/]+)/Assets/(?<assetId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/InventoryManager/Inventory/{inventoryId}/Assets/{assetId}'"); } // replace URI parameters with values from identity var inventoryId = _match.Groups["inventoryId"].Value; var assetId = _match.Groups["assetId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + inventoryId + "/Assets/" + assetId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteInventoryAssetWithResult_Call (request, eventListener,sender); } } /// <summary>Delete the inventory asset</summary> /// <param name="inventoryId"></param> /// <param name="assetId">FQDN of the asset</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteInventoryAssetWithResult(long inventoryId, string assetId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + (inventoryId.ToString()) + "/Assets/" + global::System.Uri.EscapeDataString(assetId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteInventoryAssetWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteInventoryAssetWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteInventoryAssetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteInventoryAsset" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteInventoryAsset_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteInventoryAsset" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="inventoryId"></param> /// <param name="assetId">FQDN of the asset</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteInventoryAsset_Validate(long inventoryId, string assetId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(assetId),assetId); } } /// <summary>Deleting an inventory</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteInventoryViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/InventoryManager/Inventory/(?<inventoryId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/InventoryManager/Inventory/{inventoryId}'"); } // replace URI parameters with values from identity var inventoryId = _match.Groups["inventoryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + inventoryId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteInventory_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Deleting an inventory</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteInventoryViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/InventoryManager/Inventory/(?<inventoryId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/InventoryManager/Inventory/{inventoryId}'"); } // replace URI parameters with values from identity var inventoryId = _match.Groups["inventoryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + inventoryId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteInventoryWithResult_Call (request, eventListener,sender); } } /// <summary>Deleting an inventory</summary> /// <param name="inventoryId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteInventoryWithResult(long inventoryId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + (inventoryId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteInventoryWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteInventoryWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteInventoryWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteInventory" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteInventory_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteInventory" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="inventoryId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteInventory_Validate(long inventoryId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete a Modifier</summary> /// <param name="clusterId">Id of the cluster whose modifier has to be deleted.</param> /// <param name="modifierName">Name of the modifier to be deleted.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteK8SRestoreModifier(long clusterId, string modifierName, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + (clusterId.ToString()) + "/Modifier/" + global::System.Uri.EscapeDataString(modifierName) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteK8SRestoreModifier_Call (request, onOk,eventListener,sender); } } /// <summary>Delete a Modifier</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteK8SRestoreModifierViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Kubernetes/(?<clusterId>[^/]+)/Modifier/(?<ModifierName>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Kubernetes/{clusterId}/Modifier/{ModifierName}'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; var modifierName = _match.Groups["ModifierName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + clusterId + "/Modifier/" + modifierName ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteK8SRestoreModifier_Call (request, onOk,eventListener,sender); } } /// <summary>Delete a Modifier</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteK8SRestoreModifierViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Kubernetes/(?<clusterId>[^/]+)/Modifier/(?<ModifierName>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Kubernetes/{clusterId}/Modifier/{ModifierName}'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; var modifierName = _match.Groups["ModifierName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + clusterId + "/Modifier/" + modifierName ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteK8SRestoreModifierWithResult_Call (request, eventListener,sender); } } /// <summary>Delete a Modifier</summary> /// <param name="clusterId">Id of the cluster whose modifier has to be deleted.</param> /// <param name="modifierName">Name of the modifier to be deleted.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteK8SRestoreModifierWithResult(long clusterId, string modifierName, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + (clusterId.ToString()) + "/Modifier/" + global::System.Uri.EscapeDataString(modifierName) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteK8SRestoreModifierWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteK8SRestoreModifierWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteK8SRestoreModifierWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteK8SRestoreModifier" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteK8SRestoreModifier_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteK8SRestoreModifier" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="clusterId">Id of the cluster whose modifier has to be deleted.</param> /// <param name="modifierName">Name of the modifier to be deleted.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteK8SRestoreModifier_Validate(long clusterId, string modifierName, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(modifierName),modifierName); } } /// <summary>Delete key management server based on Id</summary> /// <param name="kmsId">Id of Key Management Server</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteKeyManagementServers(long kmsId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/KeyManagementServers/" + (kmsId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteKeyManagementServers_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Delete key management server based on Id</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteKeyManagementServersViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/KeyManagementServers/(?<kmsId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/KeyManagementServers/{kmsId}'"); } // replace URI parameters with values from identity var kmsId = _match.Groups["kmsId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/KeyManagementServers/" + kmsId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteKeyManagementServers_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Delete key management server based on Id</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteKeyManagementServersViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/KeyManagementServers/(?<kmsId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/KeyManagementServers/{kmsId}'"); } // replace URI parameters with values from identity var kmsId = _match.Groups["kmsId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/KeyManagementServers/" + kmsId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteKeyManagementServersWithResult_Call (request, eventListener,sender); } } /// <summary>Delete key management server based on Id</summary> /// <param name="kmsId">Id of Key Management Server</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteKeyManagementServersWithResult(long kmsId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/KeyManagementServers/" + (kmsId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteKeyManagementServersWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteKeyManagementServersWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteKeyManagementServersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteKeyManagementServers" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteKeyManagementServers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteKeyManagementServers" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="kmsId">Id of Key Management Server</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteKeyManagementServers_Validate(long kmsId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to delete a Kubernetes application group with applicationGroupId</summary> /// <param name="applicationGroupId">applicationGroupId is the ID of the Kubernetes application group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteKubernetesAppGroup(long applicationGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + (applicationGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteKubernetesAppGroup_Call (request, onOk,eventListener,sender); } } /// <summary>API to delete a Kubernetes application group with applicationGroupId</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteKubernetesAppGroupViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/ApplicationGroup/(?<applicationGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/ApplicationGroup/{applicationGroupId}'"); } // replace URI parameters with values from identity var applicationGroupId = _match.Groups["applicationGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + applicationGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteKubernetesAppGroup_Call (request, onOk,eventListener,sender); } } /// <summary>API to delete a Kubernetes application group with applicationGroupId</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteKubernetesAppGroupViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/ApplicationGroup/(?<applicationGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/ApplicationGroup/{applicationGroupId}'"); } // replace URI parameters with values from identity var applicationGroupId = _match.Groups["applicationGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + applicationGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteKubernetesAppGroupWithResult_Call (request, eventListener,sender); } } /// <summary>API to delete a Kubernetes application group with applicationGroupId</summary> /// <param name="applicationGroupId">applicationGroupId is the ID of the Kubernetes application group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteKubernetesAppGroupWithResult(long applicationGroupId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + (applicationGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteKubernetesAppGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteKubernetesAppGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteKubernetesAppGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteKubernetesAppGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteKubernetesAppGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteKubernetesAppGroup" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="applicationGroupId">applicationGroupId is the ID of the Kubernetes application group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteKubernetesAppGroup_Validate(long applicationGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteLaptopBackupDestination(long planId, long backupDestinationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteLaptopBackupDestination_Call (request, onOk,onNotFound,onPreconditionFailed,onInternalServerError,eventListener,sender); } } /// <summary>Delete Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteLaptopBackupDestinationViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteLaptopBackupDestination_Call (request, onOk,onNotFound,onPreconditionFailed,onInternalServerError,eventListener,sender); } } /// <summary>Delete Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLaptopBackupDestinationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteLaptopBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary>Delete Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLaptopBackupDestinationWithResult(long planId, long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteLaptopBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteLaptopBackupDestinationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLaptopBackupDestinationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.PreconditionFailed: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteLaptopBackupDestination" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onPreconditionFailed">a delegate that is called when the remote service returns 412 (PreconditionFailed).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteLaptopBackupDestination_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onPreconditionFailed, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.PreconditionFailed: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onPreconditionFailed(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteLaptopBackupDestination" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteLaptopBackupDestination_Validate(long planId, long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete existing laptop plan</summary> /// <param name="planId">Id of the plan</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteLaptopPlanById(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteLaptopPlanById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Delete existing laptop plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteLaptopPlanByIdViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteLaptopPlanById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Delete existing laptop plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLaptopPlanByIdViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteLaptopPlanByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Delete existing laptop plan</summary> /// <param name="planId">Id of the plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLaptopPlanByIdWithResult(long planId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteLaptopPlanByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteLaptopPlanByIdWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLaptopPlanByIdWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteLaptopPlanById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteLaptopPlanById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteLaptopPlanById" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteLaptopPlanById_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete a media agent to a local storage access path</summary> /// <param name="storagePoolId">Id of the local storage pool whose access path has to be deleted</param> /// <param name="backupLocationId">Id of the mount path whose access path has to be deleted</param> /// <param name="accessPathId">Id of the mount path whose access path has to be deleted</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteLocalAccessPath(long storagePoolId, long backupLocationId, long accessPathId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath/" + (accessPathId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteLocalAccessPath_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to delete a media agent to a local storage access path</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteLocalAccessPathViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath/(?<accessPathId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath/{accessPathId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; var accessPathId = _match.Groups["accessPathId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath/" + accessPathId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteLocalAccessPath_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to delete a media agent to a local storage access path</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLocalAccessPathViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath/(?<accessPathId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath/{accessPathId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; var accessPathId = _match.Groups["accessPathId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath/" + accessPathId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteLocalAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete a media agent to a local storage access path</summary> /// <param name="storagePoolId">Id of the local storage pool whose access path has to be deleted</param> /// <param name="backupLocationId">Id of the mount path whose access path has to be deleted</param> /// <param name="accessPathId">Id of the mount path whose access path has to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLocalAccessPathWithResult(long storagePoolId, long backupLocationId, long accessPathId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath/" + (accessPathId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteLocalAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteLocalAccessPathWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLocalAccessPathWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteLocalAccessPath" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteLocalAccessPath_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteLocalAccessPath" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the local storage pool whose access path has to be deleted</param> /// <param name="backupLocationId">Id of the mount path whose access path has to be deleted</param> /// <param name="accessPathId">Id of the mount path whose access path has to be deleted</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteLocalAccessPath_Validate(long storagePoolId, long backupLocationId, long accessPathId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete an existing mount path of local storage pool.</summary> /// <param name="storagePoolId">Id of the local storage pool to whose backup location has to be deleted.</param> /// <param name="backupLocationId">Id of the backup location to delete</param> /// <param name="forceDelete">Force deletes a backup location.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteLocalBackupLocation(long storagePoolId, long backupLocationId, bool? forceDelete, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "?" + (null == forceDelete ? global::System.String.Empty : "forceDelete=" + global::System.Uri.EscapeDataString(forceDelete.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteLocalBackupLocation_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Delete an existing mount path of local storage pool.</summary> /// <param name="viaIdentity"></param> /// <param name="forceDelete">Force deletes a backup location.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteLocalBackupLocationViaIdentity(global::System.String viaIdentity, bool? forceDelete, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation/{backupLocationId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation/" + backupLocationId + "?" + (null == forceDelete ? global::System.String.Empty : "forceDelete=" + global::System.Uri.EscapeDataString(forceDelete.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteLocalBackupLocation_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Delete an existing mount path of local storage pool.</summary> /// <param name="viaIdentity"></param> /// <param name="forceDelete">Force deletes a backup location.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLocalBackupLocationViaIdentityWithResult(global::System.String viaIdentity, bool? forceDelete, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation/{backupLocationId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation/" + backupLocationId + "?" + (null == forceDelete ? global::System.String.Empty : "forceDelete=" + global::System.Uri.EscapeDataString(forceDelete.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteLocalBackupLocationWithResult_Call (request, eventListener,sender); } } /// <summary>Delete an existing mount path of local storage pool.</summary> /// <param name="storagePoolId">Id of the local storage pool to whose backup location has to be deleted.</param> /// <param name="backupLocationId">Id of the backup location to delete</param> /// <param name="forceDelete">Force deletes a backup location.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLocalBackupLocationWithResult(long storagePoolId, long backupLocationId, bool? forceDelete, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "?" + (null == forceDelete ? global::System.String.Empty : "forceDelete=" + global::System.Uri.EscapeDataString(forceDelete.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteLocalBackupLocationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteLocalBackupLocationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLocalBackupLocationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteLocalBackupLocation" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteLocalBackupLocation_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteLocalBackupLocation" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="storagePoolId">Id of the local storage pool to whose backup location has to be deleted.</param> /// <param name="backupLocationId">Id of the backup location to delete</param> /// <param name="forceDelete">Force deletes a backup location.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteLocalBackupLocation_Validate(long storagePoolId, long backupLocationId, bool? forceDelete, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete a local storage pool</summary> /// <param name="storagePoolId">Id of the local storage pool to delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteLocalStorage(long storagePoolId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteLocalStorage_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a local storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteLocalStorageViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteLocalStorage_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a local storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLocalStorageViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteLocalStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete a local storage pool</summary> /// <param name="storagePoolId">Id of the local storage pool to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLocalStorageWithResult(long storagePoolId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteLocalStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteLocalStorageWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteLocalStorageWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteLocalStorage" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteLocalStorage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteLocalStorage" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the local storage pool to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteLocalStorage_Validate(long storagePoolId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete a media agent.</summary> /// <param name="mediaAgentId">Id of the media agent to delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteMediaAgent(long mediaAgentId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + (mediaAgentId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteMediaAgent_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a media agent.</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteMediaAgentViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/mediaAgent/(?<mediaAgentId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/mediaAgent/{mediaAgentId}'"); } // replace URI parameters with values from identity var mediaAgentId = _match.Groups["mediaAgentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + mediaAgentId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteMediaAgent_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a media agent.</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteMediaAgentViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/mediaAgent/(?<mediaAgentId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/mediaAgent/{mediaAgentId}'"); } // replace URI parameters with values from identity var mediaAgentId = _match.Groups["mediaAgentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + mediaAgentId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteMediaAgentWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete a media agent.</summary> /// <param name="mediaAgentId">Id of the media agent to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteMediaAgentWithResult(long mediaAgentId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + (mediaAgentId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteMediaAgentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteMediaAgentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteMediaAgentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteMediaAgent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteMediaAgent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteMediaAgent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="mediaAgentId">Id of the media agent to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteMediaAgent_Validate(long mediaAgentId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete multiple triggered alerts</summary> /// <param name="body">Array of ids of an entity</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteMultipleTriggeredalerts(Commvault.Powershell.Models.IAlertIds body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/Action/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteMultipleTriggeredalerts_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Delete multiple triggered alerts</summary> /// <param name="body">Array of ids of an entity</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteMultipleTriggeredalertsWithResult(Commvault.Powershell.Models.IAlertIds body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/Action/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteMultipleTriggeredalertsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteMultipleTriggeredalertsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteMultipleTriggeredalertsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteMultipleTriggeredalerts" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteMultipleTriggeredalerts_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteMultipleTriggeredalerts" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="body">Array of ids of an entity</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteMultipleTriggeredalerts_Validate(Commvault.Powershell.Models.IAlertIds body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Delete multiple userGroups</summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteMultipleUserGroups(Commvault.Powershell.Models.IDeleteMultipleUserGroups body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup/action/delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteMultipleUserGroups_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Delete multiple userGroups</summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteMultipleUserGroupsWithResult(Commvault.Powershell.Models.IDeleteMultipleUserGroups body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup/action/delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteMultipleUserGroupsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteMultipleUserGroupsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteMultipleUserGroupsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteMultipleUserGroups" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteMultipleUserGroups_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteMultipleUserGroups" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteMultipleUserGroups_Validate(Commvault.Powershell.Models.IDeleteMultipleUserGroups body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Delete multiple users</summary> /// <param name="body">Used to delete multiple users and carry out property transfership of deleted users</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteMultipleUsers(Commvault.Powershell.Models.IDeleteMultipleUsers body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/action/delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteMultipleUsers_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Delete multiple users</summary> /// <param name="body">Used to delete multiple users and carry out property transfership of deleted users</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteMultipleUsersWithResult(Commvault.Powershell.Models.IDeleteMultipleUsers body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/action/delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteMultipleUsersWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteMultipleUsersWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteMultipleUsersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteMultipleUsers" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteMultipleUsers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteMultipleUsers" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Used to delete multiple users and carry out property transfership of deleted users</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteMultipleUsers_Validate(Commvault.Powershell.Models.IDeleteMultipleUsers body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to delete an existing server plan</summary> /// <param name="planId">Id of the object store plan to delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteObjectStorePlan(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ObjectStorePlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteObjectStorePlan_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete an existing server plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteObjectStorePlanViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ObjectStorePlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ObjectStorePlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ObjectStorePlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteObjectStorePlan_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete an existing server plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteObjectStorePlanViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ObjectStorePlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ObjectStorePlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ObjectStorePlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteObjectStorePlanWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete an existing server plan</summary> /// <param name="planId">Id of the object store plan to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteObjectStorePlanWithResult(long planId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ObjectStorePlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteObjectStorePlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteObjectStorePlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteObjectStorePlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteObjectStorePlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteObjectStorePlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteObjectStorePlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the object store plan to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteObjectStorePlan_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete an existing server plan</summary> /// <param name="planId">Id of the plan to delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeletePlan(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeletePlan_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Api to delete selected plan rule</summary> /// <param name="ruleId">Id of the rule to update in Plan</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeletePlanRule(long ruleId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/" + (ruleId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeletePlanRule_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Api to delete selected plan rule</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeletePlanRuleViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/Rule/(?<ruleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/Rule/{ruleId}'"); } // replace URI parameters with values from identity var ruleId = _match.Groups["ruleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/" + ruleId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeletePlanRule_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Api to delete selected plan rule</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeletePlanRuleViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/Rule/(?<ruleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/Rule/{ruleId}'"); } // replace URI parameters with values from identity var ruleId = _match.Groups["ruleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/" + ruleId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeletePlanRuleWithResult_Call (request, eventListener,sender); } } /// <summary>Api to delete selected plan rule</summary> /// <param name="ruleId">Id of the rule to update in Plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeletePlanRuleWithResult(long ruleId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/" + (ruleId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeletePlanRuleWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeletePlanRuleWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeletePlanRuleWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeletePlanRule" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeletePlanRule_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeletePlanRule" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="ruleId">Id of the rule to update in Plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeletePlanRule_Validate(long ruleId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete an existing server plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeletePlanViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeletePlan_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete an existing server plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeletePlanViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeletePlanWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete an existing server plan</summary> /// <param name="planId">Id of the plan to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeletePlanWithResult(long planId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeletePlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeletePlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeletePlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeletePlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeletePlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeletePlan" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="planId">Id of the plan to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeletePlan_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete recovery entities for a group</summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="body">DeleteRecoveryEntityReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteRecoveryEntities(long recoveryGroupId, Commvault.Powershell.Models.IDeleteRecoveryEntityReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + (recoveryGroupId.ToString()) + "/Entity" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteRecoveryEntities_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Delete recovery entities for a group</summary> /// <param name="viaIdentity"></param> /// <param name="body">DeleteRecoveryEntityReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteRecoveryEntitiesViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IDeleteRecoveryEntityReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/RecoveryGroup/(?<recoveryGroupId>[^/]+)/Entity$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryGroup/{recoveryGroupId}/Entity'"); } // replace URI parameters with values from identity var recoveryGroupId = _match.Groups["recoveryGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + recoveryGroupId + "/Entity" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteRecoveryEntities_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Delete recovery entities for a group</summary> /// <param name="viaIdentity"></param> /// <param name="body">DeleteRecoveryEntityReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRecoveryEntitiesViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IDeleteRecoveryEntityReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/RecoveryGroup/(?<recoveryGroupId>[^/]+)/Entity$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryGroup/{recoveryGroupId}/Entity'"); } // replace URI parameters with values from identity var recoveryGroupId = _match.Groups["recoveryGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + recoveryGroupId + "/Entity" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteRecoveryEntitiesWithResult_Call (request, eventListener,sender); } } /// <summary>Delete recovery entities for a group</summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="body">DeleteRecoveryEntityReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRecoveryEntitiesWithResult(long recoveryGroupId, Commvault.Powershell.Models.IDeleteRecoveryEntityReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + (recoveryGroupId.ToString()) + "/Entity" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteRecoveryEntitiesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteRecoveryEntitiesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRecoveryEntitiesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteRecoveryEntities" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteRecoveryEntities_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteRecoveryEntities" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="body">DeleteRecoveryEntityReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteRecoveryEntities_Validate(long recoveryGroupId, Commvault.Powershell.Models.IDeleteRecoveryEntityReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Delete recovery group</summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteRecoveryGroup(long recoveryGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + (recoveryGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteRecoveryGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Delete recovery group</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteRecoveryGroupViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/RecoveryGroup/(?<recoveryGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryGroup/{recoveryGroupId}'"); } // replace URI parameters with values from identity var recoveryGroupId = _match.Groups["recoveryGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + recoveryGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteRecoveryGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Delete recovery group</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp> DeleteRecoveryGroupViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/RecoveryGroup/(?<recoveryGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryGroup/{recoveryGroupId}'"); } // replace URI parameters with values from identity var recoveryGroupId = _match.Groups["recoveryGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + recoveryGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteRecoveryGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Delete recovery group</summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp> DeleteRecoveryGroupWithResult(long recoveryGroupId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + (recoveryGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteRecoveryGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteRecoveryGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp> DeleteRecoveryGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateRecoveryGroupResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteRecoveryGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteRecoveryGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateRecoveryGroupResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteRecoveryGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteRecoveryGroup_Validate(long recoveryGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete a specific recovery point store</summary> /// <param name="rpsId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteRecoveryPointStores(string rpsId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryPointStore/" + global::System.Uri.EscapeDataString(rpsId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteRecoveryPointStores_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Delete a specific recovery point store</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteRecoveryPointStoresViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/RecoveryPointStore/(?<rpsId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/RecoveryPointStore/{rpsId}'"); } // replace URI parameters with values from identity var rpsId = _match.Groups["rpsId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryPointStore/" + rpsId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteRecoveryPointStores_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Delete a specific recovery point store</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRecoveryPointStoresViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/RecoveryPointStore/(?<rpsId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/RecoveryPointStore/{rpsId}'"); } // replace URI parameters with values from identity var rpsId = _match.Groups["rpsId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryPointStore/" + rpsId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteRecoveryPointStoresWithResult_Call (request, eventListener,sender); } } /// <summary>Delete a specific recovery point store</summary> /// <param name="rpsId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRecoveryPointStoresWithResult(string rpsId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryPointStore/" + global::System.Uri.EscapeDataString(rpsId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteRecoveryPointStoresWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteRecoveryPointStoresWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRecoveryPointStoresWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteRecoveryPointStores" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteRecoveryPointStores_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteRecoveryPointStores" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="rpsId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteRecoveryPointStores_Validate(string rpsId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(rpsId),rpsId); } } /// <summary>To delete an exisitng recovery target</summary> /// <param name="recoveryTargetId">id of recovery target</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteRecoveryTarget(long recoveryTargetId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryTarget/" + (recoveryTargetId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteRecoveryTarget_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>To delete an exisitng recovery target</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteRecoveryTargetViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/RecoveryTarget/(?<recoveryTargetId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/RecoveryTarget/{recoveryTargetId}'"); } // replace URI parameters with values from identity var recoveryTargetId = _match.Groups["recoveryTargetId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryTarget/" + recoveryTargetId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteRecoveryTarget_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>To delete an exisitng recovery target</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRecoveryTargetViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/RecoveryTarget/(?<recoveryTargetId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/RecoveryTarget/{recoveryTargetId}'"); } // replace URI parameters with values from identity var recoveryTargetId = _match.Groups["recoveryTargetId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryTarget/" + recoveryTargetId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteRecoveryTargetWithResult_Call (request, eventListener,sender); } } /// <summary>To delete an exisitng recovery target</summary> /// <param name="recoveryTargetId">id of recovery target</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRecoveryTargetWithResult(long recoveryTargetId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryTarget/" + (recoveryTargetId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteRecoveryTargetWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteRecoveryTargetWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRecoveryTargetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteRecoveryTarget" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteRecoveryTarget_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteRecoveryTarget" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="recoveryTargetId">id of recovery target</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteRecoveryTarget_Validate(long recoveryTargetId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete the region</summary> /// <param name="regionId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteRegion(long regionId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions/" + (regionId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteRegion_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Delete the region</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteRegionViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Regions/(?<regionId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Regions/{regionId}'"); } // replace URI parameters with values from identity var regionId = _match.Groups["regionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions/" + regionId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteRegion_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Delete the region</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRegionViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Regions/(?<regionId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Regions/{regionId}'"); } // replace URI parameters with values from identity var regionId = _match.Groups["regionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions/" + regionId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteRegionWithResult_Call (request, eventListener,sender); } } /// <summary>Delete the region</summary> /// <param name="regionId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRegionWithResult(long regionId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions/" + (regionId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteRegionWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteRegionWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRegionWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteRegion" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteRegion_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteRegion" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="regionId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteRegion_Validate(long regionId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Deleting an existing request</summary> /// <param name="requestId">Unique identifier for the request</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteRequestManagerRequest(long requestId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request/" + (requestId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteRequestManagerRequest_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Deleting an existing request</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteRequestManagerRequestViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/RequestManager/Request/(?<requestId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/RequestManager/Request/{requestId}'"); } // replace URI parameters with values from identity var requestId = _match.Groups["requestId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request/" + requestId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteRequestManagerRequest_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Deleting an existing request</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRequestManagerRequestViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/RequestManager/Request/(?<requestId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/RequestManager/Request/{requestId}'"); } // replace URI parameters with values from identity var requestId = _match.Groups["requestId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request/" + requestId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteRequestManagerRequestWithResult_Call (request, eventListener,sender); } } /// <summary>Deleting an existing request</summary> /// <param name="requestId">Unique identifier for the request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRequestManagerRequestWithResult(long requestId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request/" + (requestId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteRequestManagerRequestWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteRequestManagerRequestWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRequestManagerRequestWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteRequestManagerRequest" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteRequestManagerRequest_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteRequestManagerRequest" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="requestId">Unique identifier for the request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteRequestManagerRequest_Validate(long requestId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete a role</summary> /// <param name="roleId">Role Id</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteRoles(long roleId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role/" + (roleId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteRoles_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a role</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteRolesViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Role/(?<roleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Role/{roleId}'"); } // replace URI parameters with values from identity var roleId = _match.Groups["roleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role/" + roleId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteRoles_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a role</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRolesViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Role/(?<roleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Role/{roleId}'"); } // replace URI parameters with values from identity var roleId = _match.Groups["roleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role/" + roleId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteRolesWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete a role</summary> /// <param name="roleId">Role Id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRolesWithResult(long roleId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role/" + (roleId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteRolesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteRolesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteRolesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteRoles" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteRoles_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteRoles" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="roleId">Role Id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteRoles_Validate(long roleId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete the clone with the given ID before the expiry time</summary> /// <param name="id">ID of the bucket</param> /// <param name="cloneId">ID of the cloned bucket</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteS3BucketClone(long id, long cloneId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + (id.ToString()) + "/Clone/" + (cloneId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteS3BucketClone_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Delete the clone with the given ID before the expiry time</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteS3BucketCloneViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CVFS/S3Bucket/(?<id>[^/]+)/Clone/(?<cloneId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CVFS/S3Bucket/{id}/Clone/{cloneId}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; var cloneId = _match.Groups["cloneId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + id + "/Clone/" + cloneId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteS3BucketClone_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Delete the clone with the given ID before the expiry time</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> DeleteS3BucketCloneViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CVFS/S3Bucket/(?<id>[^/]+)/Clone/(?<cloneId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CVFS/S3Bucket/{id}/Clone/{cloneId}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; var cloneId = _match.Groups["cloneId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + id + "/Clone/" + cloneId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteS3BucketCloneWithResult_Call (request, eventListener,sender); } } /// <summary>Delete the clone with the given ID before the expiry time</summary> /// <param name="id">ID of the bucket</param> /// <param name="cloneId">ID of the cloned bucket</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> DeleteS3BucketCloneWithResult(long id, long cloneId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + (id.ToString()) + "/Clone/" + (cloneId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteS3BucketCloneWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteS3BucketCloneWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> DeleteS3BucketCloneWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteS3BucketClone" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteS3BucketClone_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteS3BucketClone" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id">ID of the bucket</param> /// <param name="cloneId">ID of the cloned bucket</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteS3BucketClone_Validate(long id, long cloneId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete a serverGroup</summary> /// <param name="serverGroupId">Id of the serverGroup to delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteServerGroup(long serverGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteServerGroup_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Api to remove associated DC plan from server group</summary> /// <param name="serverGroupId"></param> /// <param name="removeChildAssociations">Optional parameter. To be set only in case, if caller want to leave child association /// as-is and decouple them from server group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteServerGroupDcPlan(long serverGroupId, bool? removeChildAssociations, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/DCPlan" + "?" + (null == removeChildAssociations ? global::System.String.Empty : "removeChildAssociations=" + global::System.Uri.EscapeDataString(removeChildAssociations.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteServerGroupDcPlan_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Api to remove associated DC plan from server group</summary> /// <param name="viaIdentity"></param> /// <param name="removeChildAssociations">Optional parameter. To be set only in case, if caller want to leave child association /// as-is and decouple them from server group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteServerGroupDcPlanViaIdentity(global::System.String viaIdentity, bool? removeChildAssociations, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/DCPlan$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/DCPlan'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/DCPlan" + "?" + (null == removeChildAssociations ? global::System.String.Empty : "removeChildAssociations=" + global::System.Uri.EscapeDataString(removeChildAssociations.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteServerGroupDcPlan_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Api to remove associated DC plan from server group</summary> /// <param name="viaIdentity"></param> /// <param name="removeChildAssociations">Optional parameter. To be set only in case, if caller want to leave child association /// as-is and decouple them from server group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteServerGroupDcPlanViaIdentityWithResult(global::System.String viaIdentity, bool? removeChildAssociations, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/DCPlan$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/DCPlan'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/DCPlan" + "?" + (null == removeChildAssociations ? global::System.String.Empty : "removeChildAssociations=" + global::System.Uri.EscapeDataString(removeChildAssociations.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteServerGroupDcPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Api to remove associated DC plan from server group</summary> /// <param name="serverGroupId"></param> /// <param name="removeChildAssociations">Optional parameter. To be set only in case, if caller want to leave child association /// as-is and decouple them from server group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteServerGroupDcPlanWithResult(long serverGroupId, bool? removeChildAssociations, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/DCPlan" + "?" + (null == removeChildAssociations ? global::System.String.Empty : "removeChildAssociations=" + global::System.Uri.EscapeDataString(removeChildAssociations.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteServerGroupDcPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteServerGroupDcPlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteServerGroupDcPlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteServerGroupDcPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteServerGroupDcPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteServerGroupDcPlan" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="serverGroupId"></param> /// <param name="removeChildAssociations">Optional parameter. To be set only in case, if caller want to leave child association /// as-is and decouple them from server group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteServerGroupDcPlan_Validate(long serverGroupId, bool? removeChildAssociations, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete a serverGroup</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteServerGroupViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteServerGroup_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to delete a serverGroup</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteServerGroupViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete a serverGroup</summary> /// <param name="serverGroupId">Id of the serverGroup to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteServerGroupWithResult(long serverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteServerGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteServerGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteServerGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteServerGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteServerGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="serverGroupId">Id of the serverGroup to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteServerGroup_Validate(long serverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete software cache for server</summary> /// <param name="clientId">Software cache client id</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteSoftwareCacheServer(long clientId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SoftwareCache/" + (clientId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteSoftwareCacheServer_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Delete software cache for server</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteSoftwareCacheServerViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/SoftwareCache/(?<clientId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/SoftwareCache/{clientId}'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SoftwareCache/" + clientId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteSoftwareCacheServer_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Delete software cache for server</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteSoftwareCacheServerViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/SoftwareCache/(?<clientId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/SoftwareCache/{clientId}'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SoftwareCache/" + clientId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteSoftwareCacheServerWithResult_Call (request, eventListener,sender); } } /// <summary>Delete software cache for server</summary> /// <param name="clientId">Software cache client id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteSoftwareCacheServerWithResult(long clientId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SoftwareCache/" + (clientId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteSoftwareCacheServerWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteSoftwareCacheServerWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteSoftwareCacheServerWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteSoftwareCacheServer" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteSoftwareCacheServer_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteSoftwareCacheServer" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="clientId">Software cache client id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteSoftwareCacheServer_Validate(long clientId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete Storage Region for an Elastic Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="regionList">List of region names/ids to be deleted. If region ids are passed, set isRegionIdList=true</param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteStorageRegion(long planId, string regionList, bool? isRegionIdList, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/storageRegion/" + global::System.Uri.EscapeDataString(regionList) + "?" + (null == isRegionIdList ? global::System.String.Empty : "isRegionIdList=" + global::System.Uri.EscapeDataString(isRegionIdList.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteStorageRegion_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Delete Storage Region for a archive Plan</summary> /// <param name="planId">Id of the Archive Plan to modify</param> /// <param name="regionList">List of region names/ids to be deleted. If region ids are passed, set isRegionIdList=true</param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteStorageRegionForArchivePlan(long planId, string regionList, bool? isRegionIdList, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) + "/storageRegion/" + global::System.Uri.EscapeDataString(regionList) + "?" + (null == isRegionIdList ? global::System.String.Empty : "isRegionIdList=" + global::System.Uri.EscapeDataString(isRegionIdList.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteStorageRegionForArchivePlan_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Delete Storage Region for a archive Plan</summary> /// <param name="viaIdentity"></param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteStorageRegionForArchivePlanViaIdentity(global::System.String viaIdentity, bool? isRegionIdList, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)/storageRegion/(?<regionList>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}/storageRegion/{regionList}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var regionList = _match.Groups["regionList"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId + "/storageRegion/" + regionList + "?" + (null == isRegionIdList ? global::System.String.Empty : "isRegionIdList=" + global::System.Uri.EscapeDataString(isRegionIdList.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteStorageRegionForArchivePlan_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Delete Storage Region for a archive Plan</summary> /// <param name="viaIdentity"></param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteStorageRegionForArchivePlanViaIdentityWithResult(global::System.String viaIdentity, bool? isRegionIdList, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)/storageRegion/(?<regionList>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}/storageRegion/{regionList}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var regionList = _match.Groups["regionList"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId + "/storageRegion/" + regionList + "?" + (null == isRegionIdList ? global::System.String.Empty : "isRegionIdList=" + global::System.Uri.EscapeDataString(isRegionIdList.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteStorageRegionForArchivePlanWithResult_Call (request, eventListener,sender); } } /// <summary>Delete Storage Region for a archive Plan</summary> /// <param name="planId">Id of the Archive Plan to modify</param> /// <param name="regionList">List of region names/ids to be deleted. If region ids are passed, set isRegionIdList=true</param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteStorageRegionForArchivePlanWithResult(long planId, string regionList, bool? isRegionIdList, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) + "/storageRegion/" + global::System.Uri.EscapeDataString(regionList) + "?" + (null == isRegionIdList ? global::System.String.Empty : "isRegionIdList=" + global::System.Uri.EscapeDataString(isRegionIdList.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteStorageRegionForArchivePlanWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteStorageRegionForArchivePlanWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteStorageRegionForArchivePlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteStorageRegionForArchivePlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteStorageRegionForArchivePlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteStorageRegionForArchivePlan" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="planId">Id of the Archive Plan to modify</param> /// <param name="regionList">List of region names/ids to be deleted. If region ids are passed, set isRegionIdList=true</param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteStorageRegionForArchivePlan_Validate(long planId, string regionList, bool? isRegionIdList, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(regionList),regionList); } } /// <summary>Delete Storage Region for a laptop Plan</summary> /// <param name="planId">Id of the Laptop Plan to modify</param> /// <param name="regionList">List of region names/ids to be deleted. If region ids are passed, set isRegionIdList=true</param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteStorageRegionForLaptopPlan(long planId, string regionList, bool? isRegionIdList, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) + "/storageRegion/" + global::System.Uri.EscapeDataString(regionList) + "?" + (null == isRegionIdList ? global::System.String.Empty : "isRegionIdList=" + global::System.Uri.EscapeDataString(isRegionIdList.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteStorageRegionForLaptopPlan_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Delete Storage Region for a laptop Plan</summary> /// <param name="viaIdentity"></param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteStorageRegionForLaptopPlanViaIdentity(global::System.String viaIdentity, bool? isRegionIdList, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)/storageRegion/(?<regionList>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}/storageRegion/{regionList}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var regionList = _match.Groups["regionList"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId + "/storageRegion/" + regionList + "?" + (null == isRegionIdList ? global::System.String.Empty : "isRegionIdList=" + global::System.Uri.EscapeDataString(isRegionIdList.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteStorageRegionForLaptopPlan_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Delete Storage Region for a laptop Plan</summary> /// <param name="viaIdentity"></param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteStorageRegionForLaptopPlanViaIdentityWithResult(global::System.String viaIdentity, bool? isRegionIdList, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)/storageRegion/(?<regionList>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}/storageRegion/{regionList}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var regionList = _match.Groups["regionList"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId + "/storageRegion/" + regionList + "?" + (null == isRegionIdList ? global::System.String.Empty : "isRegionIdList=" + global::System.Uri.EscapeDataString(isRegionIdList.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteStorageRegionForLaptopPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Delete Storage Region for a laptop Plan</summary> /// <param name="planId">Id of the Laptop Plan to modify</param> /// <param name="regionList">List of region names/ids to be deleted. If region ids are passed, set isRegionIdList=true</param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteStorageRegionForLaptopPlanWithResult(long planId, string regionList, bool? isRegionIdList, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) + "/storageRegion/" + global::System.Uri.EscapeDataString(regionList) + "?" + (null == isRegionIdList ? global::System.String.Empty : "isRegionIdList=" + global::System.Uri.EscapeDataString(isRegionIdList.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteStorageRegionForLaptopPlanWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DeleteStorageRegionForLaptopPlanWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteStorageRegionForLaptopPlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteStorageRegionForLaptopPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteStorageRegionForLaptopPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteStorageRegionForLaptopPlan" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="planId">Id of the Laptop Plan to modify</param> /// <param name="regionList">List of region names/ids to be deleted. If region ids are passed, set isRegionIdList=true</param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteStorageRegionForLaptopPlan_Validate(long planId, string regionList, bool? isRegionIdList, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(regionList),regionList); } } /// <summary>Delete Storage Region for an Elastic Plan</summary> /// <param name="viaIdentity"></param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteStorageRegionViaIdentity(global::System.String viaIdentity, bool? isRegionIdList, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/storageRegion/(?<regionList>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/storageRegion/{regionList}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var regionList = _match.Groups["regionList"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/storageRegion/" + regionList + "?" + (null == isRegionIdList ? global::System.String.Empty : "isRegionIdList=" + global::System.Uri.EscapeDataString(isRegionIdList.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteStorageRegion_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Delete Storage Region for an Elastic Plan</summary> /// <param name="viaIdentity"></param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteStorageRegionViaIdentityWithResult(global::System.String viaIdentity, bool? isRegionIdList, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/storageRegion/(?<regionList>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/storageRegion/{regionList}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var regionList = _match.Groups["regionList"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/storageRegion/" + regionList + "?" + (null == isRegionIdList ? global::System.String.Empty : "isRegionIdList=" + global::System.Uri.EscapeDataString(isRegionIdList.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteStorageRegionWithResult_Call (request, eventListener,sender); } } /// <summary>Delete Storage Region for an Elastic Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="regionList">List of region names/ids to be deleted. If region ids are passed, set isRegionIdList=true</param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteStorageRegionWithResult(long planId, string regionList, bool? isRegionIdList, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/storageRegion/" + global::System.Uri.EscapeDataString(regionList) + "?" + (null == isRegionIdList ? global::System.String.Empty : "isRegionIdList=" + global::System.Uri.EscapeDataString(isRegionIdList.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteStorageRegionWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteStorageRegionWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteStorageRegionWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteStorageRegion" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteStorageRegion_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteStorageRegion" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="regionList">List of region names/ids to be deleted. If region ids are passed, set isRegionIdList=true</param> /// <param name="isRegionIdList">Is regionList a list of region ids</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteStorageRegion_Validate(long planId, string regionList, bool? isRegionIdList, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(regionList),regionList); } } /// <summary>Delete Storage Region for a Global Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="regionId">Region id to be deleted.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteStorageTagRegion(long planId, long regionId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Global/ServerPlan/" + (planId.ToString()) + "/storageRegion/" + (regionId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteStorageTagRegion_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Delete Storage Region for a Global Plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteStorageTagRegionViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Global/ServerPlan/(?<planId>[^/]+)/storageRegion/(?<regionId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Global/ServerPlan/{planId}/storageRegion/{regionId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var regionId = _match.Groups["regionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Global/ServerPlan/" + planId + "/storageRegion/" + regionId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteStorageTagRegion_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Delete Storage Region for a Global Plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteStorageTagRegionViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Global/ServerPlan/(?<planId>[^/]+)/storageRegion/(?<regionId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Global/ServerPlan/{planId}/storageRegion/{regionId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var regionId = _match.Groups["regionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Global/ServerPlan/" + planId + "/storageRegion/" + regionId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteStorageTagRegionWithResult_Call (request, eventListener,sender); } } /// <summary>Delete Storage Region for a Global Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="regionId">Region id to be deleted.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteStorageTagRegionWithResult(long planId, long regionId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Global/ServerPlan/" + (planId.ToString()) + "/storageRegion/" + (regionId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteStorageTagRegionWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteStorageTagRegionWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteStorageTagRegionWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteStorageTagRegion" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteStorageTagRegion_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteStorageTagRegion" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="regionId">Region id to be deleted.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteStorageTagRegion_Validate(long planId, long regionId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Delete Triggered Alerts</summary> /// <param name="id"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteTriggeredAlerts(long id, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + (id.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteTriggeredAlerts_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Delete Triggered Alerts</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteTriggeredAlertsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/TriggeredAlerts/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/TriggeredAlerts/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + id ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteTriggeredAlerts_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Delete Triggered Alerts</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteTriggeredAlertsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/TriggeredAlerts/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/TriggeredAlerts/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + id ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteTriggeredAlertsWithResult_Call (request, eventListener,sender); } } /// <summary>Delete Triggered Alerts</summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteTriggeredAlertsWithResult(long id, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + (id.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteTriggeredAlertsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteTriggeredAlertsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteTriggeredAlertsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteTriggeredAlerts" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteTriggeredAlerts_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteTriggeredAlerts" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteTriggeredAlerts_Validate(long id, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete a user</summary> /// <param name="userId">Id of the user to delete</param> /// <param name="skipOwnerShipTransfer">If user properties needn't be transferred to other user or usergroup</param> /// <param name="transferToUser">If user properties needs to be transferred to other user</param> /// <param name="transfertoUserGroup">If user properties needs to be transferred to other userGroup</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteUser(long userId, bool? skipOwnerShipTransfer, long? transferToUser, long? transfertoUserGroup, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + (userId.ToString()) + "?" + (null == skipOwnerShipTransfer ? global::System.String.Empty : "skipOwnerShipTransfer=" + global::System.Uri.EscapeDataString(skipOwnerShipTransfer.ToString())) + "&" + (null == transferToUser ? global::System.String.Empty : "transferToUser=" + global::System.Uri.EscapeDataString(transferToUser.ToString())) + "&" + (null == transfertoUserGroup ? global::System.String.Empty : "transfertoUserGroup=" + global::System.Uri.EscapeDataString(transfertoUserGroup.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteUser_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a user-group</summary> /// <param name="userGroupId">Id of the user-group to delete</param> /// <param name="skipOwnerShipTransfer">If user group properties needn't be transferred to other user or usergroup</param> /// <param name="transferToUser">If user group properties needs to be transferred to other user</param> /// <param name="transfertoUserGroup">If user group properties needs to be transferred to other userGroup</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteUserGroup(long userGroupId, bool? skipOwnerShipTransfer, long? transferToUser, long? transfertoUserGroup, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup/" + (userGroupId.ToString()) + "?" + (null == skipOwnerShipTransfer ? global::System.String.Empty : "skipOwnerShipTransfer=" + global::System.Uri.EscapeDataString(skipOwnerShipTransfer.ToString())) + "&" + (null == transferToUser ? global::System.String.Empty : "transferToUser=" + global::System.Uri.EscapeDataString(transferToUser.ToString())) + "&" + (null == transfertoUserGroup ? global::System.String.Empty : "transfertoUserGroup=" + global::System.Uri.EscapeDataString(transfertoUserGroup.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteUserGroup_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a user-group</summary> /// <param name="viaIdentity"></param> /// <param name="skipOwnerShipTransfer">If user group properties needn't be transferred to other user or usergroup</param> /// <param name="transferToUser">If user group properties needs to be transferred to other user</param> /// <param name="transfertoUserGroup">If user group properties needs to be transferred to other userGroup</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteUserGroupViaIdentity(global::System.String viaIdentity, bool? skipOwnerShipTransfer, long? transferToUser, long? transfertoUserGroup, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/UserGroup/(?<userGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/UserGroup/{userGroupId}'"); } // replace URI parameters with values from identity var userGroupId = _match.Groups["userGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup/" + userGroupId + "?" + (null == skipOwnerShipTransfer ? global::System.String.Empty : "skipOwnerShipTransfer=" + global::System.Uri.EscapeDataString(skipOwnerShipTransfer.ToString())) + "&" + (null == transferToUser ? global::System.String.Empty : "transferToUser=" + global::System.Uri.EscapeDataString(transferToUser.ToString())) + "&" + (null == transfertoUserGroup ? global::System.String.Empty : "transfertoUserGroup=" + global::System.Uri.EscapeDataString(transfertoUserGroup.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteUserGroup_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a user-group</summary> /// <param name="viaIdentity"></param> /// <param name="skipOwnerShipTransfer">If user group properties needn't be transferred to other user or usergroup</param> /// <param name="transferToUser">If user group properties needs to be transferred to other user</param> /// <param name="transfertoUserGroup">If user group properties needs to be transferred to other userGroup</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteUserGroupViaIdentityWithResult(global::System.String viaIdentity, bool? skipOwnerShipTransfer, long? transferToUser, long? transfertoUserGroup, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/UserGroup/(?<userGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/UserGroup/{userGroupId}'"); } // replace URI parameters with values from identity var userGroupId = _match.Groups["userGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup/" + userGroupId + "?" + (null == skipOwnerShipTransfer ? global::System.String.Empty : "skipOwnerShipTransfer=" + global::System.Uri.EscapeDataString(skipOwnerShipTransfer.ToString())) + "&" + (null == transferToUser ? global::System.String.Empty : "transferToUser=" + global::System.Uri.EscapeDataString(transferToUser.ToString())) + "&" + (null == transfertoUserGroup ? global::System.String.Empty : "transfertoUserGroup=" + global::System.Uri.EscapeDataString(transfertoUserGroup.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteUserGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete a user-group</summary> /// <param name="userGroupId">Id of the user-group to delete</param> /// <param name="skipOwnerShipTransfer">If user group properties needn't be transferred to other user or usergroup</param> /// <param name="transferToUser">If user group properties needs to be transferred to other user</param> /// <param name="transfertoUserGroup">If user group properties needs to be transferred to other userGroup</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteUserGroupWithResult(long userGroupId, bool? skipOwnerShipTransfer, long? transferToUser, long? transfertoUserGroup, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup/" + (userGroupId.ToString()) + "?" + (null == skipOwnerShipTransfer ? global::System.String.Empty : "skipOwnerShipTransfer=" + global::System.Uri.EscapeDataString(skipOwnerShipTransfer.ToString())) + "&" + (null == transferToUser ? global::System.String.Empty : "transferToUser=" + global::System.Uri.EscapeDataString(transferToUser.ToString())) + "&" + (null == transfertoUserGroup ? global::System.String.Empty : "transfertoUserGroup=" + global::System.Uri.EscapeDataString(transfertoUserGroup.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteUserGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteUserGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteUserGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteUserGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteUserGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteUserGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="userGroupId">Id of the user-group to delete</param> /// <param name="skipOwnerShipTransfer">If user group properties needn't be transferred to other user or usergroup</param> /// <param name="transferToUser">If user group properties needs to be transferred to other user</param> /// <param name="transfertoUserGroup">If user group properties needs to be transferred to other userGroup</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteUserGroup_Validate(long userGroupId, bool? skipOwnerShipTransfer, long? transferToUser, long? transfertoUserGroup, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete a user</summary> /// <param name="viaIdentity"></param> /// <param name="skipOwnerShipTransfer">If user properties needn't be transferred to other user or usergroup</param> /// <param name="transferToUser">If user properties needs to be transferred to other user</param> /// <param name="transfertoUserGroup">If user properties needs to be transferred to other userGroup</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteUserViaIdentity(global::System.String viaIdentity, bool? skipOwnerShipTransfer, long? transferToUser, long? transfertoUserGroup, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/user/(?<userId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/user/{userId}'"); } // replace URI parameters with values from identity var userId = _match.Groups["userId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + userId + "?" + (null == skipOwnerShipTransfer ? global::System.String.Empty : "skipOwnerShipTransfer=" + global::System.Uri.EscapeDataString(skipOwnerShipTransfer.ToString())) + "&" + (null == transferToUser ? global::System.String.Empty : "transferToUser=" + global::System.Uri.EscapeDataString(transferToUser.ToString())) + "&" + (null == transfertoUserGroup ? global::System.String.Empty : "transfertoUserGroup=" + global::System.Uri.EscapeDataString(transfertoUserGroup.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteUser_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a user</summary> /// <param name="viaIdentity"></param> /// <param name="skipOwnerShipTransfer">If user properties needn't be transferred to other user or usergroup</param> /// <param name="transferToUser">If user properties needs to be transferred to other user</param> /// <param name="transfertoUserGroup">If user properties needs to be transferred to other userGroup</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteUserViaIdentityWithResult(global::System.String viaIdentity, bool? skipOwnerShipTransfer, long? transferToUser, long? transfertoUserGroup, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/user/(?<userId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/user/{userId}'"); } // replace URI parameters with values from identity var userId = _match.Groups["userId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + userId + "?" + (null == skipOwnerShipTransfer ? global::System.String.Empty : "skipOwnerShipTransfer=" + global::System.Uri.EscapeDataString(skipOwnerShipTransfer.ToString())) + "&" + (null == transferToUser ? global::System.String.Empty : "transferToUser=" + global::System.Uri.EscapeDataString(transferToUser.ToString())) + "&" + (null == transfertoUserGroup ? global::System.String.Empty : "transfertoUserGroup=" + global::System.Uri.EscapeDataString(transfertoUserGroup.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteUserWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete a user</summary> /// <param name="userId">Id of the user to delete</param> /// <param name="skipOwnerShipTransfer">If user properties needn't be transferred to other user or usergroup</param> /// <param name="transferToUser">If user properties needs to be transferred to other user</param> /// <param name="transfertoUserGroup">If user properties needs to be transferred to other userGroup</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteUserWithResult(long userId, bool? skipOwnerShipTransfer, long? transferToUser, long? transfertoUserGroup, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + (userId.ToString()) + "?" + (null == skipOwnerShipTransfer ? global::System.String.Empty : "skipOwnerShipTransfer=" + global::System.Uri.EscapeDataString(skipOwnerShipTransfer.ToString())) + "&" + (null == transferToUser ? global::System.String.Empty : "transferToUser=" + global::System.Uri.EscapeDataString(transferToUser.ToString())) + "&" + (null == transfertoUserGroup ? global::System.String.Empty : "transfertoUserGroup=" + global::System.Uri.EscapeDataString(transfertoUserGroup.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteUserWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteUserWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteUserWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteUser" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteUser_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteUser" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="userId">Id of the user to delete</param> /// <param name="skipOwnerShipTransfer">If user properties needn't be transferred to other user or usergroup</param> /// <param name="transferToUser">If user properties needs to be transferred to other user</param> /// <param name="transfertoUserGroup">If user properties needs to be transferred to other userGroup</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteUser_Validate(long userId, bool? skipOwnerShipTransfer, long? transferToUser, long? transfertoUserGroup, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>delete an existing vm group</summary> /// <param name="vmGroupId">Id of the vmgroup to delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteVMGroup(long vmGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IVmgroupdeleteResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VmGroup/" + (vmGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteVMGroup_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>delete an existing vm group</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteVMGroupViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IVmgroupdeleteResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VmGroup/(?<VmGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VmGroup/{VmGroupId}'"); } // replace URI parameters with values from identity var vmGroupId = _match.Groups["VmGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VmGroup/" + vmGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteVMGroup_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteVMGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteVMGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IVmgroupdeleteResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.VmgroupdeleteResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteVMGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="vmGroupId">Id of the vmgroup to delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteVMGroup_Validate(long vmGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to delete a virtual machine</summary> /// <param name="vmUuid">The vmUUID can be obtained from GET /virtualMachines UUID property</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteVirtualMachine(string vmUuid, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VirtualMachines/" + global::System.Uri.EscapeDataString(vmUuid) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteVirtualMachine_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a virtual machine</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DeleteVirtualMachineViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VirtualMachines/(?<vmUUID>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VirtualMachines/{vmUUID}'"); } // replace URI parameters with values from identity var vmUuid = _match.Groups["vmUUID"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VirtualMachines/" + vmUuid ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DeleteVirtualMachine_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Used to delete a virtual machine</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteVirtualMachineViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VirtualMachines/(?<vmUUID>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VirtualMachines/{vmUUID}'"); } // replace URI parameters with values from identity var vmUuid = _match.Groups["vmUUID"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VirtualMachines/" + vmUuid ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteVirtualMachineWithResult_Call (request, eventListener,sender); } } /// <summary>Used to delete a virtual machine</summary> /// <param name="vmUuid">The vmUUID can be obtained from GET /virtualMachines UUID property</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteVirtualMachineWithResult(string vmUuid, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VirtualMachines/" + global::System.Uri.EscapeDataString(vmUuid) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DeleteVirtualMachineWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DeleteVirtualMachineWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DeleteVirtualMachineWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DeleteVirtualMachine" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteVirtualMachine_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DeleteVirtualMachine" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="vmUuid">The vmUUID can be obtained from GET /virtualMachines UUID property</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DeleteVirtualMachine_Validate(string vmUuid, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(vmUuid),vmUuid); } } /// <summary>Disable the alert custom rule by using the given alert rule id</summary> /// <param name="alertRuleId">Unique Id of the alert custom rule to disable it</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableAlertCustomRule(long alertRuleId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + (alertRuleId.ToString()) + "/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableAlertCustomRule_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Disable the alert custom rule by using the given alert rule id</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableAlertCustomRuleViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/Alert/CustomRule/(?<alertRuleId>[^/]+)/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/Alert/CustomRule/{alertRuleId}/Disable'"); } // replace URI parameters with values from identity var alertRuleId = _match.Groups["alertRuleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + alertRuleId + "/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableAlertCustomRule_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Disable the alert custom rule by using the given alert rule id</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp> DisableAlertCustomRuleViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/Alert/CustomRule/(?<alertRuleId>[^/]+)/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/Alert/CustomRule/{alertRuleId}/Disable'"); } // replace URI parameters with values from identity var alertRuleId = _match.Groups["alertRuleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + alertRuleId + "/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableAlertCustomRuleWithResult_Call (request, eventListener,sender); } } /// <summary>Disable the alert custom rule by using the given alert rule id</summary> /// <param name="alertRuleId">Unique Id of the alert custom rule to disable it</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp> DisableAlertCustomRuleWithResult(long alertRuleId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + (alertRuleId.ToString()) + "/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableAlertCustomRuleWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableAlertCustomRuleWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp> DisableAlertCustomRuleWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertRuleGenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableAlertCustomRule" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableAlertCustomRule_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertRuleGenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableAlertCustomRule" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="alertRuleId">Unique Id of the alert custom rule to disable it</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableAlertCustomRule_Validate(long alertRuleId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Disable Alert Definition</summary> /// <param name="id"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableAlertDefinitions(long id, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + (id.ToString()) + "/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableAlertDefinitions_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Disable Alert Definition</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableAlertDefinitionsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AlertDefinitions/(?<id>[^/]+)/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AlertDefinitions/{id}/Disable'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + id + "/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableAlertDefinitions_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Disable Alert Definition</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableAlertDefinitionsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AlertDefinitions/(?<id>[^/]+)/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AlertDefinitions/{id}/Disable'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + id + "/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableAlertDefinitionsWithResult_Call (request, eventListener,sender); } } /// <summary>Disable Alert Definition</summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableAlertDefinitionsWithResult(long id, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + (id.ToString()) + "/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableAlertDefinitionsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableAlertDefinitionsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableAlertDefinitionsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableAlertDefinitions" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableAlertDefinitions_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableAlertDefinitions" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableAlertDefinitions_Validate(long id, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable all job activity property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableAllJobActivityCommcell(long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/AllJobActivity/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableAllJobActivityCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable all job activity property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableAllJobActivityCommcellViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/AllJobActivity/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/AllJobActivity/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/AllJobActivity/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableAllJobActivityCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable all job activity property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableAllJobActivityCommcellViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/AllJobActivity/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/AllJobActivity/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/AllJobActivity/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableAllJobActivityCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable all job activity property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableAllJobActivityCommcellWithResult(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/AllJobActivity/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableAllJobActivityCommcellWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DisableAllJobActivityCommcellWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableAllJobActivityCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableAllJobActivityCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableAllJobActivityCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableAllJobActivityCommcell" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableAllJobActivityCommcell_Validate(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable auxillary copy property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableAuxillaryCopyCommcell(long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/AuxillaryCopy/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableAuxillaryCopyCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable auxillary copy property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableAuxillaryCopyCommcellViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/AuxillaryCopy/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/AuxillaryCopy/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/AuxillaryCopy/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableAuxillaryCopyCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable auxillary copy property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableAuxillaryCopyCommcellViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/AuxillaryCopy/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/AuxillaryCopy/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/AuxillaryCopy/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableAuxillaryCopyCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable auxillary copy property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableAuxillaryCopyCommcellWithResult(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/AuxillaryCopy/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableAuxillaryCopyCommcellWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DisableAuxillaryCopyCommcellWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableAuxillaryCopyCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableAuxillaryCopyCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableAuxillaryCopyCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableAuxillaryCopyCommcell" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableAuxillaryCopyCommcell_Validate(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// Used to disable backup property for an agent. /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableBackupAgent(long serverId, long agentId, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Agent/" + (agentId.ToString()) + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableBackupAgent_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary> /// Used to disable backup property for an agent. /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableBackupAgentViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Agent/(?<agentId>[^/]+)/Backup/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Agent/{agentId}/Backup/Action/Disable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; var agentId = _match.Groups["agentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Agent/" + agentId + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableBackupAgent_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary> /// Used to disable backup property for an agent. /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupAgentViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Agent/(?<agentId>[^/]+)/Backup/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Agent/{agentId}/Backup/Action/Disable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; var agentId = _match.Groups["agentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Agent/" + agentId + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableBackupAgentWithResult_Call (request, eventListener,sender); } } /// <summary> /// Used to disable backup property for an agent. /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupAgentWithResult(long serverId, long agentId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Agent/" + (agentId.ToString()) + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableBackupAgentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableBackupAgentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupAgentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableBackupAgent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableBackupAgent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableBackupAgent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableBackupAgent_Validate(long serverId, long agentId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable backup property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableBackupCommcell(long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableBackupCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable backup property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableBackupCommcellViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/Backup/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/Backup/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableBackupCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable backup property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupCommcellViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/Backup/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/Backup/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableBackupCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable backup property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupCommcellWithResult(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableBackupCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableBackupCommcellWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableBackupCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableBackupCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableBackupCommcell" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableBackupCommcell_Validate(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable backup property for an instance</summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableBackupInstance(long instanceId, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + (instanceId.ToString()) + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableBackupInstance_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable backup property for an instance</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableBackupInstanceViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Instance/(?<instanceId>[^/]+)/Backup/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Instance/{instanceId}/Backup/Action/Disable'"); } // replace URI parameters with values from identity var instanceId = _match.Groups["instanceId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + instanceId + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableBackupInstance_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable backup property for an instance</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupInstanceViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Instance/(?<instanceId>[^/]+)/Backup/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Instance/{instanceId}/Backup/Action/Disable'"); } // replace URI parameters with values from identity var instanceId = _match.Groups["instanceId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + instanceId + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableBackupInstanceWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable backup property for an instance</summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupInstanceWithResult(long instanceId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + (instanceId.ToString()) + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableBackupInstanceWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableBackupInstanceWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupInstanceWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableBackupInstance" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableBackupInstance_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableBackupInstance" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableBackupInstance_Validate(long instanceId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to Disable backup schedule policies on server plan</summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableBackupOnPlan(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/Backup/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableBackupOnPlan_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>API to Disable backup schedule policies on server plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableBackupOnPlanViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/Backup/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/Backup/Disable'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/Backup/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableBackupOnPlan_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>API to Disable backup schedule policies on server plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupOnPlanViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/Backup/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/Backup/Disable'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/Backup/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableBackupOnPlanWithResult_Call (request, eventListener,sender); } } /// <summary>API to Disable backup schedule policies on server plan</summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupOnPlanWithResult(long planId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/Backup/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableBackupOnPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableBackupOnPlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupOnPlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableBackupOnPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableBackupOnPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableBackupOnPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableBackupOnPlan_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable backup property for server</summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableBackupServer(long serverId, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableBackupServer_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable backup property for a server group</summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableBackupServerGroup(long serverGroupId, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableBackupServerGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable backup property for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableBackupServerGroupViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/Backup/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/Backup/Action/Disable'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableBackupServerGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable backup property for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupServerGroupViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/Backup/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/Backup/Action/Disable'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableBackupServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable backup property for a server group</summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupServerGroupWithResult(long serverGroupId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableBackupServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableBackupServerGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupServerGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableBackupServerGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableBackupServerGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableBackupServerGroup" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableBackupServerGroup_Validate(long serverGroupId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable backup property for server</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableBackupServerViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Backup/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Backup/Action/Disable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableBackupServer_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable backup property for server</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupServerViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Backup/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Backup/Action/Disable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableBackupServerWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable backup property for server</summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupServerWithResult(long serverId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableBackupServerWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableBackupServerWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupServerWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableBackupServer" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableBackupServer_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableBackupServer" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableBackupServer_Validate(long? enableAfterADelay, long serverId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable backup property for a subclient</summary> /// <param name="subclientId">Id of the subclient to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableBackupSubclient(long subclientId, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Subclient/" + (subclientId.ToString()) + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableBackupSubclient_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable backup property for a subclient</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableBackupSubclientViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Subclient/(?<subclientId>[^/]+)/Backup/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Subclient/{subclientId}/Backup/Action/Disable'"); } // replace URI parameters with values from identity var subclientId = _match.Groups["subclientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Subclient/" + subclientId + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableBackupSubclient_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable backup property for a subclient</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupSubclientViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Subclient/(?<subclientId>[^/]+)/Backup/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Subclient/{subclientId}/Backup/Action/Disable'"); } // replace URI parameters with values from identity var subclientId = _match.Groups["subclientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Subclient/" + subclientId + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableBackupSubclientWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable backup property for a subclient</summary> /// <param name="subclientId">Id of the subclient to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupSubclientWithResult(long subclientId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Subclient/" + (subclientId.ToString()) + "/Backup/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableBackupSubclientWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableBackupSubclientWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableBackupSubclientWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableBackupSubclient" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableBackupSubclient_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableBackupSubclient" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="subclientId">Id of the subclient to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableBackupSubclient_Validate(long subclientId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable content indexing property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableContentIndexingCommcell(long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/ContentIndexing/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableContentIndexingCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable content indexing property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableContentIndexingCommcellViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/ContentIndexing/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/ContentIndexing/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/ContentIndexing/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableContentIndexingCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable content indexing property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableContentIndexingCommcellViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/ContentIndexing/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/ContentIndexing/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/ContentIndexing/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableContentIndexingCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable content indexing property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableContentIndexingCommcellWithResult(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/ContentIndexing/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableContentIndexingCommcellWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DisableContentIndexingCommcellWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableContentIndexingCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableContentIndexingCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableContentIndexingCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableContentIndexingCommcell" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableContentIndexingCommcell_Validate(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable data aging property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableDataAgingCommcell(long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DataAging/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableDataAgingCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable data aging property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableDataAgingCommcellViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/DataAging/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/DataAging/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DataAging/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableDataAgingCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable data aging property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDataAgingCommcellViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/DataAging/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/DataAging/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DataAging/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableDataAgingCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable data aging property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDataAgingCommcellWithResult(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DataAging/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableDataAgingCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableDataAgingCommcellWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDataAgingCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableDataAgingCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableDataAgingCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableDataAgingCommcell" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableDataAgingCommcell_Validate(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable Data Aging property for server</summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableDataAgingServer(long serverId, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/DataAging/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableDataAgingServer_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable data aging property for a server group</summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableDataAgingServerGroup(long serverGroupId, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/DataAging/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableDataAgingServerGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable data aging property for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableDataAgingServerGroupViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/DataAging/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/DataAging/Action/Disable'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/DataAging/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableDataAgingServerGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable data aging property for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDataAgingServerGroupViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/DataAging/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/DataAging/Action/Disable'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/DataAging/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableDataAgingServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable data aging property for a server group</summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDataAgingServerGroupWithResult(long serverGroupId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/DataAging/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableDataAgingServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DisableDataAgingServerGroupWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDataAgingServerGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableDataAgingServerGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableDataAgingServerGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableDataAgingServerGroup" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableDataAgingServerGroup_Validate(long serverGroupId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable Data Aging property for server</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableDataAgingServerViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/DataAging/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/DataAging/Action/Disable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/DataAging/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableDataAgingServer_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable Data Aging property for server</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDataAgingServerViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/DataAging/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/DataAging/Action/Disable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/DataAging/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableDataAgingServerWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable Data Aging property for server</summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDataAgingServerWithResult(long serverId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/DataAging/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableDataAgingServerWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableDataAgingServerWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDataAgingServerWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableDataAgingServer" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableDataAgingServer_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableDataAgingServer" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableDataAgingServer_Validate(long? enableAfterADelay, long serverId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable data verification property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableDataVerificationCommcell(long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DataVerification/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableDataVerificationCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable data verification property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableDataVerificationCommcellViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/DataVerification/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/DataVerification/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DataVerification/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableDataVerificationCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable data verification property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDataVerificationCommcellViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/DataVerification/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/DataVerification/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DataVerification/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableDataVerificationCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable data verification property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDataVerificationCommcellWithResult(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DataVerification/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableDataVerificationCommcellWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DisableDataVerificationCommcellWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDataVerificationCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableDataVerificationCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableDataVerificationCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableDataVerificationCommcell" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableDataVerificationCommcell_Validate(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable DDB property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableDdbCommcell(long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DDB/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableDdbCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable DDB property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableDdbCommcellViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/DDB/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/DDB/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DDB/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableDdbCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable DDB property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDdbCommcellViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/DDB/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/DDB/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DDB/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableDdbCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable DDB property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDdbCommcellWithResult(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DDB/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableDdbCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableDdbCommcellWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableDdbCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableDdbCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableDdbCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableDdbCommcell" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableDdbCommcell_Validate(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Disable local authentication for the company</summary> /// <param name="companyId">Id of the company</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableLocalAuthenticationForCompany(long companyId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/LocalAuthentication/Action/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableLocalAuthenticationForCompany_Call (request, onOk,eventListener,sender); } } /// <summary>Disable local authentication for the company</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableLocalAuthenticationForCompanyViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/LocalAuthentication/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/LocalAuthentication/Action/Disable'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/LocalAuthentication/Action/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableLocalAuthenticationForCompany_Call (request, onOk,eventListener,sender); } } /// <summary>Disable local authentication for the company</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableLocalAuthenticationForCompanyViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/LocalAuthentication/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/LocalAuthentication/Action/Disable'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/LocalAuthentication/Action/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableLocalAuthenticationForCompanyWithResult_Call (request, eventListener,sender); } } /// <summary>Disable local authentication for the company</summary> /// <param name="companyId">Id of the company</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableLocalAuthenticationForCompanyWithResult(long companyId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/LocalAuthentication/Action/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableLocalAuthenticationForCompanyWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DisableLocalAuthenticationForCompanyWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableLocalAuthenticationForCompanyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "DisableLocalAuthenticationForCompany" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableLocalAuthenticationForCompany_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableLocalAuthenticationForCompany" /> method. Call this like the actual call, but /// you will get validation events back. /// </summary> /// <param name="companyId">Id of the company</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableLocalAuthenticationForCompany_Validate(long companyId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable log scrubbing</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableLogScrubbing(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/scrubLogs/Action/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableLogScrubbing_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable log scrubbing</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableLogScrubbingWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/scrubLogs/Action/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableLogScrubbingWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableLogScrubbingWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableLogScrubbingWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableLogScrubbing" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableLogScrubbing_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableLogScrubbing" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableLogScrubbing_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// API is used to disable maintenance for a storage pool. /// It will take the libraries associated to storage pool out maintenance mode and if the storage pool is HyperScale, then /// same would be applied to the nodes associated to the storage pool. /// Storage pool will be marked availabe for upcoming jobs. /// </summary> /// <param name="storagePoolId">Id of storage pool</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableMaintenanceForStoragePool(long storagePoolId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + (storagePoolId.ToString()) + "/maintenance/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableMaintenanceForStoragePool_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary> /// API is used to disable maintenance for a storage pool. /// It will take the libraries associated to storage pool out maintenance mode and if the storage pool is HyperScale, then /// same would be applied to the nodes associated to the storage pool. /// Storage pool will be marked availabe for upcoming jobs. /// </summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableMaintenanceForStoragePoolViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StoragePool/(?<StoragePoolId>[^/]+)/maintenance/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StoragePool/{StoragePoolId}/maintenance/Disable'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["StoragePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + storagePoolId + "/maintenance/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableMaintenanceForStoragePool_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary> /// API is used to disable maintenance for a storage pool. /// It will take the libraries associated to storage pool out maintenance mode and if the storage pool is HyperScale, then /// same would be applied to the nodes associated to the storage pool. /// Storage pool will be marked availabe for upcoming jobs. /// </summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> DisableMaintenanceForStoragePoolViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StoragePool/(?<StoragePoolId>[^/]+)/maintenance/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StoragePool/{StoragePoolId}/maintenance/Disable'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["StoragePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + storagePoolId + "/maintenance/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableMaintenanceForStoragePoolWithResult_Call (request, eventListener,sender); } } /// <summary> /// API is used to disable maintenance for a storage pool. /// It will take the libraries associated to storage pool out maintenance mode and if the storage pool is HyperScale, then /// same would be applied to the nodes associated to the storage pool. /// Storage pool will be marked availabe for upcoming jobs. /// </summary> /// <param name="storagePoolId">Id of storage pool</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> DisableMaintenanceForStoragePoolWithResult(long storagePoolId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + (storagePoolId.ToString()) + "/maintenance/Disable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableMaintenanceForStoragePoolWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DisableMaintenanceForStoragePoolWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> DisableMaintenanceForStoragePoolWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableMaintenanceForStoragePool" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableMaintenanceForStoragePool_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableMaintenanceForStoragePool" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="storagePoolId">Id of storage pool</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableMaintenanceForStoragePool_Validate(long storagePoolId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// Used to disable restore property for an agent /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableRestoreAgent(long serverId, long agentId, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Agent/" + (agentId.ToString()) + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableRestoreAgent_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary> /// Used to disable restore property for an agent /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableRestoreAgentViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Agent/(?<agentId>[^/]+)/Restore/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Agent/{agentId}/Restore/Action/Disable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; var agentId = _match.Groups["agentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Agent/" + agentId + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableRestoreAgent_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary> /// Used to disable restore property for an agent /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreAgentViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Agent/(?<agentId>[^/]+)/Restore/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Agent/{agentId}/Restore/Action/Disable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; var agentId = _match.Groups["agentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Agent/" + agentId + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableRestoreAgentWithResult_Call (request, eventListener,sender); } } /// <summary> /// Used to disable restore property for an agent /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreAgentWithResult(long serverId, long agentId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Agent/" + (agentId.ToString()) + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableRestoreAgentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableRestoreAgentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreAgentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableRestoreAgent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableRestoreAgent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableRestoreAgent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableRestoreAgent_Validate(long serverId, long agentId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable restore property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableRestoreCommcell(long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableRestoreCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable restore property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableRestoreCommcellViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/Restore/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/Restore/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableRestoreCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable restore property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreCommcellViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/Restore/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/Restore/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableRestoreCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable restore property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreCommcellWithResult(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableRestoreCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableRestoreCommcellWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableRestoreCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableRestoreCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableRestoreCommcell" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableRestoreCommcell_Validate(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable restore property for an instance</summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableRestoreInstance(long instanceId, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + (instanceId.ToString()) + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableRestoreInstance_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable restore property for an instance</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableRestoreInstanceViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Instance/(?<instanceId>[^/]+)/Restore/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Instance/{instanceId}/Restore/Action/Disable'"); } // replace URI parameters with values from identity var instanceId = _match.Groups["instanceId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + instanceId + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableRestoreInstance_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable restore property for an instance</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreInstanceViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Instance/(?<instanceId>[^/]+)/Restore/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Instance/{instanceId}/Restore/Action/Disable'"); } // replace URI parameters with values from identity var instanceId = _match.Groups["instanceId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + instanceId + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableRestoreInstanceWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable restore property for an instance</summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreInstanceWithResult(long instanceId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + (instanceId.ToString()) + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableRestoreInstanceWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableRestoreInstanceWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreInstanceWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableRestoreInstance" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableRestoreInstance_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableRestoreInstance" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableRestoreInstance_Validate(long instanceId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable restore property for server</summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableRestoreServer(long serverId, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableRestoreServer_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable restore property for a server group</summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableRestoreServerGroup(long serverGroupId, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableRestoreServerGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable restore property for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableRestoreServerGroupViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/Restore/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/Restore/Action/Disable'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableRestoreServerGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable restore property for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreServerGroupViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/Restore/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/Restore/Action/Disable'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableRestoreServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable restore property for a server group</summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreServerGroupWithResult(long serverGroupId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableRestoreServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DisableRestoreServerGroupWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreServerGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableRestoreServerGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableRestoreServerGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableRestoreServerGroup" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableRestoreServerGroup_Validate(long serverGroupId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable restore property for server</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableRestoreServerViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Restore/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Restore/Action/Disable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableRestoreServer_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable restore property for server</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreServerViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Restore/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Restore/Action/Disable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableRestoreServerWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable restore property for server</summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreServerWithResult(long serverId, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Restore/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableRestoreServerWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableRestoreServerWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableRestoreServerWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableRestoreServer" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableRestoreServer_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableRestoreServer" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableRestoreServer_Validate(long? enableAfterADelay, long serverId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to disable scheduler property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableSchedulerCommcell(long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Scheduler/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableSchedulerCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable scheduler property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DisableSchedulerCommcellViaIdentity(global::System.String viaIdentity, long? enableAfterADelay, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/Scheduler/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/Scheduler/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Scheduler/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DisableSchedulerCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to disable scheduler property for commcell</summary> /// <param name="viaIdentity"></param> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableSchedulerCommcellViaIdentityWithResult(global::System.String viaIdentity, long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Commcell/Scheduler/Action/Disable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Commcell/Scheduler/Action/Disable'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Scheduler/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableSchedulerCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Used to disable scheduler property for commcell</summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableSchedulerCommcellWithResult(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Scheduler/Action/Disable" + "?" + (null == enableAfterADelay ? global::System.String.Empty : "enableAfterADelay=" + global::System.Uri.EscapeDataString(enableAfterADelay.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DisableSchedulerCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DisableSchedulerCommcellWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> DisableSchedulerCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DisableSchedulerCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableSchedulerCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DisableSchedulerCommcell" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="enableAfterADelay">Provide UTC time in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DisableSchedulerCommcell_Validate(long? enableAfterADelay, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// Used to fetch available media agents which can be added as access paths for disk storage /// </summary> /// <param name="storagePoolId">Id of the disk storage pool whose media agent has to be shared</param> /// <param name="backupLocationId">Id of the back up location of which media agent has to be shared</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DiskGetEligibleMediaAgentsForAccessPath(long storagePoolId, long backupLocationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath/MediaAgents" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DiskGetEligibleMediaAgentsForAccessPath_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary> /// Used to fetch available media agents which can be added as access paths for disk storage /// </summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DiskGetEligibleMediaAgentsForAccessPathViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath/MediaAgents$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath/MediaAgents'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath/MediaAgents" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DiskGetEligibleMediaAgentsForAccessPath_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary> /// Used to fetch available media agents which can be added as access paths for disk storage /// </summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList> DiskGetEligibleMediaAgentsForAccessPathViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath/MediaAgents$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath/MediaAgents'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath/MediaAgents" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DiskGetEligibleMediaAgentsForAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary> /// Used to fetch available media agents which can be added as access paths for disk storage /// </summary> /// <param name="storagePoolId">Id of the disk storage pool whose media agent has to be shared</param> /// <param name="backupLocationId">Id of the back up location of which media agent has to be shared</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList> DiskGetEligibleMediaAgentsForAccessPathWithResult(long storagePoolId, long backupLocationId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath/MediaAgents" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DiskGetEligibleMediaAgentsForAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "DiskGetEligibleMediaAgentsForAccessPathWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList> DiskGetEligibleMediaAgentsForAccessPathWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MediaAgentList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "DiskGetEligibleMediaAgentsForAccessPath" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DiskGetEligibleMediaAgentsForAccessPath_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MediaAgentList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DiskGetEligibleMediaAgentsForAccessPath" /> method. Call this like the actual call, but /// you will get validation events back. /// </summary> /// <param name="storagePoolId">Id of the disk storage pool whose media agent has to be shared</param> /// <param name="backupLocationId">Id of the back up location of which media agent has to be shared</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DiskGetEligibleMediaAgentsForAccessPath_Validate(long storagePoolId, long backupLocationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to browse backed up applications for an application group</summary> /// <param name="applicationGroupId">ID of the application group to browse for</param> /// <param name="page">Page number for number of results in pagination</param> /// <param name="limit">Page limit for number of results in pagination</param> /// <param name="fromTime">Browse from a specific time (in epochs)</param> /// <param name="toTime">Browse till a specific time (in epochs)</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DoApplicationBrowse(long applicationGroupId, long? page, long? limit, long? fromTime, long? toTime, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesAppGroupApplicationBrowseResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + (applicationGroupId.ToString()) + "/Browse/Application" + "?" + (null == page ? global::System.String.Empty : "page=" + global::System.Uri.EscapeDataString(page.ToString())) + "&" + (null == limit ? global::System.String.Empty : "limit=" + global::System.Uri.EscapeDataString(limit.ToString())) + "&" + (null == fromTime ? global::System.String.Empty : "fromTime=" + global::System.Uri.EscapeDataString(fromTime.ToString())) + "&" + (null == toTime ? global::System.String.Empty : "toTime=" + global::System.Uri.EscapeDataString(toTime.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DoApplicationBrowse_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to browse backed up applications for an application group</summary> /// <param name="viaIdentity"></param> /// <param name="page">Page number for number of results in pagination</param> /// <param name="limit">Page limit for number of results in pagination</param> /// <param name="fromTime">Browse from a specific time (in epochs)</param> /// <param name="toTime">Browse till a specific time (in epochs)</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DoApplicationBrowseViaIdentity(global::System.String viaIdentity, long? page, long? limit, long? fromTime, long? toTime, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesAppGroupApplicationBrowseResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/ApplicationGroup/(?<applicationGroupId>[^/]+)/Browse/Application$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/ApplicationGroup/{applicationGroupId}/Browse/Application'"); } // replace URI parameters with values from identity var applicationGroupId = _match.Groups["applicationGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + applicationGroupId + "/Browse/Application" + "?" + (null == page ? global::System.String.Empty : "page=" + global::System.Uri.EscapeDataString(page.ToString())) + "&" + (null == limit ? global::System.String.Empty : "limit=" + global::System.Uri.EscapeDataString(limit.ToString())) + "&" + (null == fromTime ? global::System.String.Empty : "fromTime=" + global::System.Uri.EscapeDataString(fromTime.ToString())) + "&" + (null == toTime ? global::System.String.Empty : "toTime=" + global::System.Uri.EscapeDataString(toTime.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DoApplicationBrowse_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DoApplicationBrowse" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DoApplicationBrowse_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesAppGroupApplicationBrowseResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.KubernetesAppGroupApplicationBrowseResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DoApplicationBrowse" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="applicationGroupId">ID of the application group to browse for</param> /// <param name="page">Page number for number of results in pagination</param> /// <param name="limit">Page limit for number of results in pagination</param> /// <param name="fromTime">Browse from a specific time (in epochs)</param> /// <param name="toTime">Browse till a specific time (in epochs)</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DoApplicationBrowse_Validate(long applicationGroupId, long? page, long? limit, long? fromTime, long? toTime, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to run Full Application Restore for an application group</summary> /// <param name="applicationGroupId">ID of the application group to restore from</param> /// <param name="body">Request body for Full Application Restore of Application Group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DoApplicationRestore(long applicationGroupId, Commvault.Powershell.Models.IKubernetesAppGroupApplicationRestore body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + (applicationGroupId.ToString()) + "/Restore/Application" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DoApplicationRestore_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to run Full Application Restore for an application group</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request body for Full Application Restore of Application Group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DoApplicationRestoreViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IKubernetesAppGroupApplicationRestore body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/ApplicationGroup/(?<applicationGroupId>[^/]+)/Restore/Application$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/ApplicationGroup/{applicationGroupId}/Restore/Application'"); } // replace URI parameters with values from identity var applicationGroupId = _match.Groups["applicationGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + applicationGroupId + "/Restore/Application" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DoApplicationRestore_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DoApplicationRestore" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DoApplicationRestore_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DoApplicationRestore" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="applicationGroupId">ID of the application group to restore from</param> /// <param name="body">Request body for Full Application Restore of Application Group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DoApplicationRestore_Validate(long applicationGroupId, Commvault.Powershell.Models.IKubernetesAppGroupApplicationRestore body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to browse backed up namespaces for an application group</summary> /// <param name="applicationGroupId">ID of the application group to browse for</param> /// <param name="page">Page number for number of results in pagination</param> /// <param name="limit">Page limit for number of results in pagination</param> /// <param name="fromTime">Browse from a specific time (in epochs)</param> /// <param name="toTime">Browse till a specific time (in epochs)</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DoNamespaceBrowse(long applicationGroupId, long? page, long? limit, long? fromTime, long? toTime, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesAppGroupNamespaceBrowseResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + (applicationGroupId.ToString()) + "/Browse/Namespace" + "?" + (null == page ? global::System.String.Empty : "page=" + global::System.Uri.EscapeDataString(page.ToString())) + "&" + (null == limit ? global::System.String.Empty : "limit=" + global::System.Uri.EscapeDataString(limit.ToString())) + "&" + (null == fromTime ? global::System.String.Empty : "fromTime=" + global::System.Uri.EscapeDataString(fromTime.ToString())) + "&" + (null == toTime ? global::System.String.Empty : "toTime=" + global::System.Uri.EscapeDataString(toTime.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DoNamespaceBrowse_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to browse backed up namespaces for an application group</summary> /// <param name="viaIdentity"></param> /// <param name="page">Page number for number of results in pagination</param> /// <param name="limit">Page limit for number of results in pagination</param> /// <param name="fromTime">Browse from a specific time (in epochs)</param> /// <param name="toTime">Browse till a specific time (in epochs)</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DoNamespaceBrowseViaIdentity(global::System.String viaIdentity, long? page, long? limit, long? fromTime, long? toTime, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesAppGroupNamespaceBrowseResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/ApplicationGroup/(?<applicationGroupId>[^/]+)/Browse/Namespace$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/ApplicationGroup/{applicationGroupId}/Browse/Namespace'"); } // replace URI parameters with values from identity var applicationGroupId = _match.Groups["applicationGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + applicationGroupId + "/Browse/Namespace" + "?" + (null == page ? global::System.String.Empty : "page=" + global::System.Uri.EscapeDataString(page.ToString())) + "&" + (null == limit ? global::System.String.Empty : "limit=" + global::System.Uri.EscapeDataString(limit.ToString())) + "&" + (null == fromTime ? global::System.String.Empty : "fromTime=" + global::System.Uri.EscapeDataString(fromTime.ToString())) + "&" + (null == toTime ? global::System.String.Empty : "toTime=" + global::System.Uri.EscapeDataString(toTime.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DoNamespaceBrowse_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DoNamespaceBrowse" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DoNamespaceBrowse_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesAppGroupNamespaceBrowseResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.KubernetesAppGroupNamespaceBrowseResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DoNamespaceBrowse" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="applicationGroupId">ID of the application group to browse for</param> /// <param name="page">Page number for number of results in pagination</param> /// <param name="limit">Page limit for number of results in pagination</param> /// <param name="fromTime">Browse from a specific time (in epochs)</param> /// <param name="toTime">Browse till a specific time (in epochs)</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DoNamespaceBrowse_Validate(long applicationGroupId, long? page, long? limit, long? fromTime, long? toTime, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to run Namespace Level Restore for an application group</summary> /// <param name="applicationGroupId">ID of the application group to restore from</param> /// <param name="body">Request body for Namespace-Level Restore of Application Group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DoNamespaceRestore(long applicationGroupId, Commvault.Powershell.Models.IKubernetesAppGroupNamespaceRestore body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + (applicationGroupId.ToString()) + "/Restore/Namespace" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DoNamespaceRestore_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to run Namespace Level Restore for an application group</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request body for Namespace-Level Restore of Application Group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DoNamespaceRestoreViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IKubernetesAppGroupNamespaceRestore body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/ApplicationGroup/(?<applicationGroupId>[^/]+)/Restore/Namespace$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/ApplicationGroup/{applicationGroupId}/Restore/Namespace'"); } // replace URI parameters with values from identity var applicationGroupId = _match.Groups["applicationGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + applicationGroupId + "/Restore/Namespace" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DoNamespaceRestore_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DoNamespaceRestore" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DoNamespaceRestore_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DoNamespaceRestore" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="applicationGroupId">ID of the application group to restore from</param> /// <param name="body">Request body for Namespace-Level Restore of Application Group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DoNamespaceRestore_Validate(long applicationGroupId, Commvault.Powershell.Models.IKubernetesAppGroupNamespaceRestore body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Download or Copy Software</summary> /// <param name="body">Request body for download or copy software</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task DownloadOrCopySoftware(Commvault.Powershell.Models.IDownloadOrCopySoftware body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DownloadSoftware" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.DownloadOrCopySoftware_Call (request, onOk,eventListener,sender); } } /// <summary>Download or Copy Software</summary> /// <param name="body">Request body for download or copy software</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse> DownloadOrCopySoftwareWithResult(Commvault.Powershell.Models.IDownloadOrCopySoftware body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DownloadSoftware" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.DownloadOrCopySoftwareWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "DownloadOrCopySoftwareWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse> DownloadOrCopySoftwareWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.JobIdResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "DownloadOrCopySoftware" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DownloadOrCopySoftware_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.JobIdResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="DownloadOrCopySoftware" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Request body for download or copy software</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task DownloadOrCopySoftware_Validate(Commvault.Powershell.Models.IDownloadOrCopySoftware body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Edit Alert Definition details</summary> /// <param name="id"></param> /// <param name="body">AlertDefinitionsEdit</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EditAlertDefinitions(long id, Commvault.Powershell.Models.IAlertDefinitionsEdit body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + (id.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EditAlertDefinitions_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Edit Alert Definition details</summary> /// <param name="viaIdentity"></param> /// <param name="body">AlertDefinitionsEdit</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EditAlertDefinitionsViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IAlertDefinitionsEdit body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AlertDefinitions/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AlertDefinitions/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + id ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EditAlertDefinitions_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Edit Alert Definition details</summary> /// <param name="viaIdentity"></param> /// <param name="body">AlertDefinitionsEdit</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditAlertDefinitionsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IAlertDefinitionsEdit body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AlertDefinitions/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AlertDefinitions/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + id ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EditAlertDefinitionsWithResult_Call (request, eventListener,sender); } } /// <summary>Edit Alert Definition details</summary> /// <param name="id"></param> /// <param name="body">AlertDefinitionsEdit</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditAlertDefinitionsWithResult(long id, Commvault.Powershell.Models.IAlertDefinitionsEdit body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + (id.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EditAlertDefinitionsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EditAlertDefinitionsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditAlertDefinitionsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EditAlertDefinitions" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EditAlertDefinitions_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EditAlertDefinitions" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id"></param> /// <param name="body">AlertDefinitionsEdit</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EditAlertDefinitions_Validate(long id, Commvault.Powershell.Models.IAlertDefinitionsEdit body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Editing Array details</summary> /// <param name="arrayId"></param> /// <param name="body">Request to pass for Edit Array</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EditArray(long arrayId, Commvault.Powershell.Models.IEditArray body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EditArray_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Editing Array details</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request to pass for Edit Array</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EditArrayViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IEditArray body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EditArray_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Editing Array details</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request to pass for Edit Array</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditArrayViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IEditArray body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EditArrayWithResult_Call (request, eventListener,sender); } } /// <summary>Editing Array details</summary> /// <param name="arrayId"></param> /// <param name="body">Request to pass for Edit Array</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditArrayWithResult(long arrayId, Commvault.Powershell.Models.IEditArray body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EditArrayWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EditArrayWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditArrayWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EditArray" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EditArray_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EditArray" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="arrayId"></param> /// <param name="body">Request to pass for Edit Array</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EditArray_Validate(long arrayId, Commvault.Powershell.Models.IEditArray body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to edit Snap Configurations at Client Level</summary> /// <param name="arrayId"></param> /// <param name="clientId"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EditClientSnapConfigs(long arrayId, long clientId, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Client/" + (clientId.ToString()) + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EditClientSnapConfigs_Call (request, onOk,eventListener,sender); } } /// <summary>API to edit Snap Configurations at Client Level</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EditClientSnapConfigsViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Client/(?<clientId>[^/]+)/Snap/Configs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Client/{clientId}/Snap/Configs'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Client/" + clientId + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EditClientSnapConfigs_Call (request, onOk,eventListener,sender); } } /// <summary>API to edit Snap Configurations at Client Level</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditClientSnapConfigsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Client/(?<clientId>[^/]+)/Snap/Configs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Client/{clientId}/Snap/Configs'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Client/" + clientId + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EditClientSnapConfigsWithResult_Call (request, eventListener,sender); } } /// <summary>API to edit Snap Configurations at Client Level</summary> /// <param name="arrayId"></param> /// <param name="clientId"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditClientSnapConfigsWithResult(long arrayId, long clientId, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Client/" + (clientId.ToString()) + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EditClientSnapConfigsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EditClientSnapConfigsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditClientSnapConfigsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EditClientSnapConfigs" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EditClientSnapConfigs_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EditClientSnapConfigs" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="arrayId"></param> /// <param name="clientId"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EditClientSnapConfigs_Validate(long arrayId, long clientId, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to edit snap configurations for storage array at copy level</summary> /// <param name="copyId"></param> /// <param name="arrayId"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EditCopySnapConfigs(long copyId, long arrayId, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Copy/" + (copyId.ToString()) + "/Arrays/" + (arrayId.ToString()) + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EditCopySnapConfigs_Call (request, onOk,eventListener,sender); } } /// <summary>API to edit snap configurations for storage array at copy level</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EditCopySnapConfigsViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Copy/(?<copyId>[^/]+)/Arrays/(?<arrayId>[^/]+)/Snap/Configs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Copy/{copyId}/Arrays/{arrayId}/Snap/Configs'"); } // replace URI parameters with values from identity var copyId = _match.Groups["copyId"].Value; var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Copy/" + copyId + "/Arrays/" + arrayId + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EditCopySnapConfigs_Call (request, onOk,eventListener,sender); } } /// <summary>API to edit snap configurations for storage array at copy level</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditCopySnapConfigsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Copy/(?<copyId>[^/]+)/Arrays/(?<arrayId>[^/]+)/Snap/Configs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Copy/{copyId}/Arrays/{arrayId}/Snap/Configs'"); } // replace URI parameters with values from identity var copyId = _match.Groups["copyId"].Value; var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Copy/" + copyId + "/Arrays/" + arrayId + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EditCopySnapConfigsWithResult_Call (request, eventListener,sender); } } /// <summary>API to edit snap configurations for storage array at copy level</summary> /// <param name="copyId"></param> /// <param name="arrayId"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditCopySnapConfigsWithResult(long copyId, long arrayId, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Copy/" + (copyId.ToString()) + "/Arrays/" + (arrayId.ToString()) + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EditCopySnapConfigsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EditCopySnapConfigsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditCopySnapConfigsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EditCopySnapConfigs" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EditCopySnapConfigs_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EditCopySnapConfigs" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="copyId"></param> /// <param name="arrayId"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EditCopySnapConfigs_Validate(long copyId, long arrayId, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Edit a Restore modifier</summary> /// <param name="clusterId">Id of the cluster whose modifier has to be modified.</param> /// <param name="modifierName">Name of the modifier to be modified.</param> /// <param name="body">Request body for K8s Modifier</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EditK8SRestoreModifier(long clusterId, string modifierName, Commvault.Powershell.Models.IK8SRestoreModifierApireq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + (clusterId.ToString()) + "/Modifier/" + global::System.Uri.EscapeDataString(modifierName) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EditK8SRestoreModifier_Call (request, onOk,eventListener,sender); } } /// <summary>Edit a Restore modifier</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request body for K8s Modifier</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EditK8SRestoreModifierViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IK8SRestoreModifierApireq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Kubernetes/(?<clusterId>[^/]+)/Modifier/(?<ModifierName>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Kubernetes/{clusterId}/Modifier/{ModifierName}'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; var modifierName = _match.Groups["ModifierName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + clusterId + "/Modifier/" + modifierName ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EditK8SRestoreModifier_Call (request, onOk,eventListener,sender); } } /// <summary>Edit a Restore modifier</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request body for K8s Modifier</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditK8SRestoreModifierViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IK8SRestoreModifierApireq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Kubernetes/(?<clusterId>[^/]+)/Modifier/(?<ModifierName>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Kubernetes/{clusterId}/Modifier/{ModifierName}'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; var modifierName = _match.Groups["ModifierName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + clusterId + "/Modifier/" + modifierName ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EditK8SRestoreModifierWithResult_Call (request, eventListener,sender); } } /// <summary>Edit a Restore modifier</summary> /// <param name="clusterId">Id of the cluster whose modifier has to be modified.</param> /// <param name="modifierName">Name of the modifier to be modified.</param> /// <param name="body">Request body for K8s Modifier</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditK8SRestoreModifierWithResult(long clusterId, string modifierName, Commvault.Powershell.Models.IK8SRestoreModifierApireq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + (clusterId.ToString()) + "/Modifier/" + global::System.Uri.EscapeDataString(modifierName) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EditK8SRestoreModifierWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EditK8SRestoreModifierWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditK8SRestoreModifierWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EditK8SRestoreModifier" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EditK8SRestoreModifier_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EditK8SRestoreModifier" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="clusterId">Id of the cluster whose modifier has to be modified.</param> /// <param name="modifierName">Name of the modifier to be modified.</param> /// <param name="body">Request body for K8s Modifier</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EditK8SRestoreModifier_Validate(long clusterId, string modifierName, Commvault.Powershell.Models.IK8SRestoreModifierApireq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(modifierName),modifierName); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to edit Snap configs at a Array level</summary> /// <param name="arrayId"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EditSnapConfigs(long arrayId, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EditSnapConfigs_Call (request, onOk,eventListener,sender); } } /// <summary>API to edit Snap configs at a Array level</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EditSnapConfigsViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snap/Configs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snap/Configs'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EditSnapConfigs_Call (request, onOk,eventListener,sender); } } /// <summary>API to edit Snap configs at a Array level</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditSnapConfigsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snap/Configs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snap/Configs'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EditSnapConfigsWithResult_Call (request, eventListener,sender); } } /// <summary>API to edit Snap configs at a Array level</summary> /// <param name="arrayId"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditSnapConfigsWithResult(long arrayId, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EditSnapConfigsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EditSnapConfigsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditSnapConfigsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EditSnapConfigs" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EditSnapConfigs_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EditSnapConfigs" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="arrayId"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EditSnapConfigs_Validate(long arrayId, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to edit Snap Configurations at Subclient level</summary> /// <param name="arrayId"></param> /// <param name="subclientId"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EditSubclientSnapConfigs(long arrayId, long subclientId, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Subclient/" + (subclientId.ToString()) + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EditSubclientSnapConfigs_Call (request, onOk,eventListener,sender); } } /// <summary>API to edit Snap Configurations at Subclient level</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EditSubclientSnapConfigsViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Subclient/(?<subclientId>[^/]+)/Snap/Configs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Subclient/{subclientId}/Snap/Configs'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; var subclientId = _match.Groups["subclientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Subclient/" + subclientId + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EditSubclientSnapConfigs_Call (request, onOk,eventListener,sender); } } /// <summary>API to edit Snap Configurations at Subclient level</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditSubclientSnapConfigsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Subclient/(?<subclientId>[^/]+)/Snap/Configs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Subclient/{subclientId}/Snap/Configs'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; var subclientId = _match.Groups["subclientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Subclient/" + subclientId + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EditSubclientSnapConfigsWithResult_Call (request, eventListener,sender); } } /// <summary>API to edit Snap Configurations at Subclient level</summary> /// <param name="arrayId"></param> /// <param name="subclientId"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditSubclientSnapConfigsWithResult(long arrayId, long subclientId, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Subclient/" + (subclientId.ToString()) + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EditSubclientSnapConfigsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EditSubclientSnapConfigsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EditSubclientSnapConfigsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EditSubclientSnapConfigs" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EditSubclientSnapConfigs_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EditSubclientSnapConfigs" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="arrayId"></param> /// <param name="subclientId"></param> /// <param name="body">Request Template to edit Snap Config</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EditSubclientSnapConfigs_Validate(long arrayId, long subclientId, Commvault.Powershell.Models.ISnapConfigOverrideEditReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary> /// This API enables Airgap on StoragePool and all its associated MediaAgents. This action is irreversible, once enabled Airgap /// cannot be disabled on the StoragePool. /// </summary> /// <param name="storagePoolId">Id of the StoragePool</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableAirgapOnStoragePool(long storagePoolId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + (storagePoolId.ToString()) + "/Airgap" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableAirgapOnStoragePool_Call (request, onOk,eventListener,sender); } } /// <summary> /// This API enables Airgap on StoragePool and all its associated MediaAgents. This action is irreversible, once enabled Airgap /// cannot be disabled on the StoragePool. /// </summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableAirgapOnStoragePoolViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StoragePool/(?<storagePoolId>[^/]+)/Airgap$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StoragePool/{storagePoolId}/Airgap'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + storagePoolId + "/Airgap" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableAirgapOnStoragePool_Call (request, onOk,eventListener,sender); } } /// <summary> /// This API enables Airgap on StoragePool and all its associated MediaAgents. This action is irreversible, once enabled Airgap /// cannot be disabled on the StoragePool. /// </summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableAirgapOnStoragePoolViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StoragePool/(?<storagePoolId>[^/]+)/Airgap$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StoragePool/{storagePoolId}/Airgap'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + storagePoolId + "/Airgap" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableAirgapOnStoragePoolWithResult_Call (request, eventListener,sender); } } /// <summary> /// This API enables Airgap on StoragePool and all its associated MediaAgents. This action is irreversible, once enabled Airgap /// cannot be disabled on the StoragePool. /// </summary> /// <param name="storagePoolId">Id of the StoragePool</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableAirgapOnStoragePoolWithResult(long storagePoolId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + (storagePoolId.ToString()) + "/Airgap" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableAirgapOnStoragePoolWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "EnableAirgapOnStoragePoolWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableAirgapOnStoragePoolWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableAirgapOnStoragePool" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableAirgapOnStoragePool_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableAirgapOnStoragePool" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="storagePoolId">Id of the StoragePool</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableAirgapOnStoragePool_Validate(long storagePoolId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Enable the alert custom rule by using the given alert rule id</summary> /// <param name="alertRuleId">Unique Id of the alert custom rule to enable it</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableAlertCustomRule(long alertRuleId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + (alertRuleId.ToString()) + "/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableAlertCustomRule_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Enable the alert custom rule by using the given alert rule id</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableAlertCustomRuleViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/Alert/CustomRule/(?<alertRuleId>[^/]+)/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/Alert/CustomRule/{alertRuleId}/Enable'"); } // replace URI parameters with values from identity var alertRuleId = _match.Groups["alertRuleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + alertRuleId + "/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableAlertCustomRule_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Enable the alert custom rule by using the given alert rule id</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp> EnableAlertCustomRuleViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/Alert/CustomRule/(?<alertRuleId>[^/]+)/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/Alert/CustomRule/{alertRuleId}/Enable'"); } // replace URI parameters with values from identity var alertRuleId = _match.Groups["alertRuleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + alertRuleId + "/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableAlertCustomRuleWithResult_Call (request, eventListener,sender); } } /// <summary>Enable the alert custom rule by using the given alert rule id</summary> /// <param name="alertRuleId">Unique Id of the alert custom rule to enable it</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp> EnableAlertCustomRuleWithResult(long alertRuleId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + (alertRuleId.ToString()) + "/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableAlertCustomRuleWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableAlertCustomRuleWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp> EnableAlertCustomRuleWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertRuleGenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableAlertCustomRule" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableAlertCustomRule_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRuleGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertRuleGenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableAlertCustomRule" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="alertRuleId">Unique Id of the alert custom rule to enable it</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableAlertCustomRule_Validate(long alertRuleId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Enable Alert Definitions</summary> /// <param name="id"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableAlertDefinitions(long id, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + (id.ToString()) + "/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableAlertDefinitions_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Enable Alert Definitions</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableAlertDefinitionsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AlertDefinitions/(?<id>[^/]+)/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AlertDefinitions/{id}/Enable'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + id + "/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableAlertDefinitions_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Enable Alert Definitions</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableAlertDefinitionsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AlertDefinitions/(?<id>[^/]+)/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AlertDefinitions/{id}/Enable'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + id + "/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableAlertDefinitionsWithResult_Call (request, eventListener,sender); } } /// <summary>Enable Alert Definitions</summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableAlertDefinitionsWithResult(long id, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + (id.ToString()) + "/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableAlertDefinitionsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableAlertDefinitionsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableAlertDefinitionsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableAlertDefinitions" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableAlertDefinitions_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableAlertDefinitions" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableAlertDefinitions_Validate(long id, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable all job activity property for commcell</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableAllJobActivity(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/AllJobActivity/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableAllJobActivity_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable all job activity property for commcell</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableAllJobActivityWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/AllJobActivity/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableAllJobActivityWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableAllJobActivityWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableAllJobActivityWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableAllJobActivity" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableAllJobActivity_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableAllJobActivity" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableAllJobActivity_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable auxillary copy property for commcell</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableAuxillaryCopyCommcell(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/AuxillaryCopy/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableAuxillaryCopyCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable auxillary copy property for commcell</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableAuxillaryCopyCommcellWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/AuxillaryCopy/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableAuxillaryCopyCommcellWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "EnableAuxillaryCopyCommcellWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableAuxillaryCopyCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableAuxillaryCopyCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableAuxillaryCopyCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableAuxillaryCopyCommcell" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableAuxillaryCopyCommcell_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// Used to enable backup property for an agent /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableBackupAgent(long serverId, long agentId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Agent/" + (agentId.ToString()) + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableBackupAgent_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary> /// Used to enable backup property for an agent /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableBackupAgentViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Agent/(?<agentId>[^/]+)/Backup/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Agent/{agentId}/Backup/Action/Enable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; var agentId = _match.Groups["agentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Agent/" + agentId + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableBackupAgent_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary> /// Used to enable backup property for an agent /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupAgentViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Agent/(?<agentId>[^/]+)/Backup/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Agent/{agentId}/Backup/Action/Enable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; var agentId = _match.Groups["agentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Agent/" + agentId + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableBackupAgentWithResult_Call (request, eventListener,sender); } } /// <summary> /// Used to enable backup property for an agent /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupAgentWithResult(long serverId, long agentId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Agent/" + (agentId.ToString()) + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableBackupAgentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableBackupAgentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupAgentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableBackupAgent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableBackupAgent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableBackupAgent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableBackupAgent_Validate(long serverId, long agentId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable backup property for commcell</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableBackupCommcell(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableBackupCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable backup property for commcell</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupCommcellWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableBackupCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableBackupCommcellWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableBackupCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableBackupCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableBackupCommcell" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableBackupCommcell_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable backup property for an instance</summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableBackupInstance(long instanceId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + (instanceId.ToString()) + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableBackupInstance_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable backup property for an instance</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableBackupInstanceViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Instance/(?<instanceId>[^/]+)/Backup/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Instance/{instanceId}/Backup/Action/Enable'"); } // replace URI parameters with values from identity var instanceId = _match.Groups["instanceId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + instanceId + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableBackupInstance_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable backup property for an instance</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupInstanceViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Instance/(?<instanceId>[^/]+)/Backup/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Instance/{instanceId}/Backup/Action/Enable'"); } // replace URI parameters with values from identity var instanceId = _match.Groups["instanceId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + instanceId + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableBackupInstanceWithResult_Call (request, eventListener,sender); } } /// <summary>Used to enable backup property for an instance</summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupInstanceWithResult(long instanceId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + (instanceId.ToString()) + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableBackupInstanceWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableBackupInstanceWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupInstanceWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableBackupInstance" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableBackupInstance_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableBackupInstance" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableBackupInstance_Validate(long instanceId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to Enable backup schedule policies on server plan</summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableBackupOnPlan(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/Backup/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableBackupOnPlan_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>API to Enable backup schedule policies on server plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableBackupOnPlanViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/Backup/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/Backup/Enable'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/Backup/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableBackupOnPlan_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>API to Enable backup schedule policies on server plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupOnPlanViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/Backup/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/Backup/Enable'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/Backup/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableBackupOnPlanWithResult_Call (request, eventListener,sender); } } /// <summary>API to Enable backup schedule policies on server plan</summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupOnPlanWithResult(long planId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/Backup/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableBackupOnPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableBackupOnPlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupOnPlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableBackupOnPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableBackupOnPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableBackupOnPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableBackupOnPlan_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable backup property for Server</summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableBackupServer(long serverId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableBackupServer_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable backup property for a server group</summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableBackupServerGroup(long serverGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableBackupServerGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable backup property for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableBackupServerGroupViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/Backup/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/Backup/Action/Enable'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableBackupServerGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable backup property for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupServerGroupViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/Backup/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/Backup/Action/Enable'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableBackupServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Used to enable backup property for a server group</summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupServerGroupWithResult(long serverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableBackupServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableBackupServerGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupServerGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableBackupServerGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableBackupServerGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableBackupServerGroup" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableBackupServerGroup_Validate(long serverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable backup property for Server</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableBackupServerViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Backup/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Backup/Action/Enable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableBackupServer_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable backup property for Server</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupServerViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Backup/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Backup/Action/Enable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableBackupServerWithResult_Call (request, eventListener,sender); } } /// <summary>Used to enable backup property for Server</summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupServerWithResult(long serverId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableBackupServerWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableBackupServerWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupServerWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableBackupServer" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableBackupServer_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableBackupServer" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableBackupServer_Validate(long serverId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable backup property for an subclient</summary> /// <param name="subclientId">Id of the subclient to modify</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableBackupSubclient(long subclientId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Subclient/" + (subclientId.ToString()) + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableBackupSubclient_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable backup property for an subclient</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableBackupSubclientViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Subclient/(?<subclientId>[^/]+)/Backup/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Subclient/{subclientId}/Backup/Action/Enable'"); } // replace URI parameters with values from identity var subclientId = _match.Groups["subclientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Subclient/" + subclientId + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableBackupSubclient_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable backup property for an subclient</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupSubclientViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Subclient/(?<subclientId>[^/]+)/Backup/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Subclient/{subclientId}/Backup/Action/Enable'"); } // replace URI parameters with values from identity var subclientId = _match.Groups["subclientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Subclient/" + subclientId + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableBackupSubclientWithResult_Call (request, eventListener,sender); } } /// <summary>Used to enable backup property for an subclient</summary> /// <param name="subclientId">Id of the subclient to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupSubclientWithResult(long subclientId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Subclient/" + (subclientId.ToString()) + "/Backup/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableBackupSubclientWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableBackupSubclientWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableBackupSubclientWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableBackupSubclient" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableBackupSubclient_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableBackupSubclient" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="subclientId">Id of the subclient to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableBackupSubclient_Validate(long subclientId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable content indexing property for commcell</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableContentIndexingCommcell(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/ContentIndexing/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableContentIndexingCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable content indexing property for commcell</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableContentIndexingCommcellWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/ContentIndexing/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableContentIndexingCommcellWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "EnableContentIndexingCommcellWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableContentIndexingCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableContentIndexingCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableContentIndexingCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableContentIndexingCommcell" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableContentIndexingCommcell_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable data aging property for commcell</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableDataAgingCommcell(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DataAging/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableDataAgingCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable data aging property for commcell</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableDataAgingCommcellWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DataAging/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableDataAgingCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableDataAgingCommcellWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableDataAgingCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableDataAgingCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableDataAgingCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableDataAgingCommcell" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableDataAgingCommcell_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable Data Aging property for Server</summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableDataAgingServer(long serverId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/DataAging/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableDataAgingServer_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable data aging property for a server group</summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableDataAgingServerGroup(long serverGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/DataAging/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableDataAgingServerGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable data aging property for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableDataAgingServerGroupViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/DataAging/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/DataAging/Action/Enable'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/DataAging/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableDataAgingServerGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable data aging property for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableDataAgingServerGroupViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/DataAging/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/DataAging/Action/Enable'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/DataAging/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableDataAgingServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Used to enable data aging property for a server group</summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableDataAgingServerGroupWithResult(long serverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/DataAging/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableDataAgingServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "EnableDataAgingServerGroupWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableDataAgingServerGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableDataAgingServerGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableDataAgingServerGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableDataAgingServerGroup" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableDataAgingServerGroup_Validate(long serverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable Data Aging property for Server</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableDataAgingServerViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/DataAging/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/DataAging/Action/Enable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/DataAging/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableDataAgingServer_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable Data Aging property for Server</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableDataAgingServerViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/DataAging/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/DataAging/Action/Enable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/DataAging/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableDataAgingServerWithResult_Call (request, eventListener,sender); } } /// <summary>Used to enable Data Aging property for Server</summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableDataAgingServerWithResult(long serverId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/DataAging/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableDataAgingServerWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableDataAgingServerWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableDataAgingServerWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableDataAgingServer" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableDataAgingServer_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableDataAgingServer" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableDataAgingServer_Validate(long serverId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable data verification property for commcell</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableDataVerificationCommcell(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DataVerification/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableDataVerificationCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable data verification property for commcell</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableDataVerificationCommcellWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DataVerification/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableDataVerificationCommcellWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "EnableDataVerificationCommcellWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableDataVerificationCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableDataVerificationCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableDataVerificationCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableDataVerificationCommcell" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableDataVerificationCommcell_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable DDB property for commcell</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableDdbCommcell(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DDB/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableDdbCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable DDB property for commcell</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableDdbCommcellWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/DDB/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableDdbCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableDdbCommcellWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableDdbCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableDdbCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableDdbCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableDdbCommcell" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableDdbCommcell_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Enable local authentication for the company</summary> /// <param name="companyId">Id of the company</param> /// <param name="body">Local authentication can be enabled for all users or specific user groups or completely disabled.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableLocalAuthenticationForCompany(long companyId, Commvault.Powershell.Models.ILocalAuthenticationDetails body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/LocalAuthentication/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableLocalAuthenticationForCompany_Call (request, onOk,eventListener,sender); } } /// <summary>Enable local authentication for the company</summary> /// <param name="viaIdentity"></param> /// <param name="body">Local authentication can be enabled for all users or specific user groups or completely disabled.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableLocalAuthenticationForCompanyViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ILocalAuthenticationDetails body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/LocalAuthentication/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/LocalAuthentication/Action/Enable'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/LocalAuthentication/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableLocalAuthenticationForCompany_Call (request, onOk,eventListener,sender); } } /// <summary>Enable local authentication for the company</summary> /// <param name="viaIdentity"></param> /// <param name="body">Local authentication can be enabled for all users or specific user groups or completely disabled.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableLocalAuthenticationForCompanyViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ILocalAuthenticationDetails body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/LocalAuthentication/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/LocalAuthentication/Action/Enable'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/LocalAuthentication/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableLocalAuthenticationForCompanyWithResult_Call (request, eventListener,sender); } } /// <summary>Enable local authentication for the company</summary> /// <param name="companyId">Id of the company</param> /// <param name="body">Local authentication can be enabled for all users or specific user groups or completely disabled.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableLocalAuthenticationForCompanyWithResult(long companyId, Commvault.Powershell.Models.ILocalAuthenticationDetails body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/LocalAuthentication/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableLocalAuthenticationForCompanyWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "EnableLocalAuthenticationForCompanyWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableLocalAuthenticationForCompanyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "EnableLocalAuthenticationForCompany" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableLocalAuthenticationForCompany_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableLocalAuthenticationForCompany" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="companyId">Id of the company</param> /// <param name="body">Local authentication can be enabled for all users or specific user groups or completely disabled.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableLocalAuthenticationForCompany_Validate(long companyId, Commvault.Powershell.Models.ILocalAuthenticationDetails body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to enable log scrubbing</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableLogScrubbing(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/scrubLogs/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableLogScrubbing_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable log scrubbing</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableLogScrubbingWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/scrubLogs/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableLogScrubbingWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableLogScrubbingWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableLogScrubbingWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableLogScrubbing" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableLogScrubbing_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableLogScrubbing" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableLogScrubbing_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// API is used to enable maintenance for a storage pool. /// It will put the libraries associated to storage pool in maintenance mode and if the storage pool is HyperScale, then same /// would be applied to the nodes associated to the storage pool. /// When a storage pool is in maintenance, it will not be used by any upcoming jobs. /// </summary> /// <param name="storagePoolId">Id of storage pool</param> /// <param name="suspendRunningJobs">Suspend the jobs running to the storage pool</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableMaintenanceForStoragePool(long storagePoolId, bool? suspendRunningJobs, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + (storagePoolId.ToString()) + "/maintenance/Enable" + "?" + (null == suspendRunningJobs ? global::System.String.Empty : "suspendRunningJobs=" + global::System.Uri.EscapeDataString(suspendRunningJobs.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableMaintenanceForStoragePool_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary> /// API is used to enable maintenance for a storage pool. /// It will put the libraries associated to storage pool in maintenance mode and if the storage pool is HyperScale, then same /// would be applied to the nodes associated to the storage pool. /// When a storage pool is in maintenance, it will not be used by any upcoming jobs. /// </summary> /// <param name="viaIdentity"></param> /// <param name="suspendRunningJobs">Suspend the jobs running to the storage pool</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableMaintenanceForStoragePoolViaIdentity(global::System.String viaIdentity, bool? suspendRunningJobs, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StoragePool/(?<StoragePoolId>[^/]+)/maintenance/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StoragePool/{StoragePoolId}/maintenance/Enable'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["StoragePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + storagePoolId + "/maintenance/Enable" + "?" + (null == suspendRunningJobs ? global::System.String.Empty : "suspendRunningJobs=" + global::System.Uri.EscapeDataString(suspendRunningJobs.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableMaintenanceForStoragePool_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary> /// API is used to enable maintenance for a storage pool. /// It will put the libraries associated to storage pool in maintenance mode and if the storage pool is HyperScale, then same /// would be applied to the nodes associated to the storage pool. /// When a storage pool is in maintenance, it will not be used by any upcoming jobs. /// </summary> /// <param name="viaIdentity"></param> /// <param name="suspendRunningJobs">Suspend the jobs running to the storage pool</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> EnableMaintenanceForStoragePoolViaIdentityWithResult(global::System.String viaIdentity, bool? suspendRunningJobs, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StoragePool/(?<StoragePoolId>[^/]+)/maintenance/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StoragePool/{StoragePoolId}/maintenance/Enable'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["StoragePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + storagePoolId + "/maintenance/Enable" + "?" + (null == suspendRunningJobs ? global::System.String.Empty : "suspendRunningJobs=" + global::System.Uri.EscapeDataString(suspendRunningJobs.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableMaintenanceForStoragePoolWithResult_Call (request, eventListener,sender); } } /// <summary> /// API is used to enable maintenance for a storage pool. /// It will put the libraries associated to storage pool in maintenance mode and if the storage pool is HyperScale, then same /// would be applied to the nodes associated to the storage pool. /// When a storage pool is in maintenance, it will not be used by any upcoming jobs. /// </summary> /// <param name="storagePoolId">Id of storage pool</param> /// <param name="suspendRunningJobs">Suspend the jobs running to the storage pool</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> EnableMaintenanceForStoragePoolWithResult(long storagePoolId, bool? suspendRunningJobs, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + (storagePoolId.ToString()) + "/maintenance/Enable" + "?" + (null == suspendRunningJobs ? global::System.String.Empty : "suspendRunningJobs=" + global::System.Uri.EscapeDataString(suspendRunningJobs.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableMaintenanceForStoragePoolWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "EnableMaintenanceForStoragePoolWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> EnableMaintenanceForStoragePoolWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableMaintenanceForStoragePool" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableMaintenanceForStoragePool_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableMaintenanceForStoragePool" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="storagePoolId">Id of storage pool</param> /// <param name="suspendRunningJobs">Suspend the jobs running to the storage pool</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableMaintenanceForStoragePool_Validate(long storagePoolId, bool? suspendRunningJobs, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// Used to enable restore property for an agent /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableRestoreAgent(long serverId, long agentId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Agent/" + (agentId.ToString()) + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableRestoreAgent_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary> /// Used to enable restore property for an agent /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableRestoreAgentViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Agent/(?<agentId>[^/]+)/Restore/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Agent/{agentId}/Restore/Action/Enable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; var agentId = _match.Groups["agentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Agent/" + agentId + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableRestoreAgent_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary> /// Used to enable restore property for an agent /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableRestoreAgentViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Agent/(?<agentId>[^/]+)/Restore/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Agent/{agentId}/Restore/Action/Enable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; var agentId = _match.Groups["agentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Agent/" + agentId + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableRestoreAgentWithResult_Call (request, eventListener,sender); } } /// <summary> /// Used to enable restore property for an agent /// Types of available agentIds are: /// 41-Active Directory, /// 21-AIX File System, /// 64-Big Data Apps, /// 134-Cloud Apps, /// 37-DB2, /// 103-DB2 MultiNode, /// 62-DB2 on Unix, /// 128-Documentum, /// 90-Domino Mailbox Archiver, /// 91-DPM, /// 67-Exchange Compliance Archiver, /// 53-Exchange Database, /// 45-Exchange Mailbox, /// 54-Exchange Mailbox (Classic), /// 56-Exchange Mailbox Archiver, /// 82-Exchange PF Archiver, /// 35-Exchange Public Folder, /// 73-File Share Archiver, /// 33-File System, /// 74-FreeBSD, /// 71-GroupWise DB, /// 17-HP-UX Files System, /// 65-Image Level, /// 75-Image Level On Unix, /// 76-Image Level ProxyHost, /// 87-Image Level ProxyHost on Unix, /// 3-Informix Database, /// 29-Linux File System, /// 89-MS SharePoint Archiver, /// 104-MySQL, /// 13-NAS, /// 83-Netware File Archiver, /// 12-Netware File System, /// 10-Novell Directory Services, /// 124-Object Link, /// 131-Object Store, /// 86-OES File System on Linux, /// 22-Oracle, /// 80-Oracle RAC, /// 130-Other External Agent, /// 125-PostgreSQL, /// 38-Proxy Client File System, /// 87-ProxyHost on Unix, /// 61-SAP for Oracle, /// 135-SAP HANA, /// 78-SharePoint Server, /// 20-Solaris 64bit File System, /// 19-Solaris File System, /// 81-SQL Server, /// 5-Sybase Database, /// 66-Unix File Archiver, /// 36-Unix Tru64 64-bit File System, /// 106-Virtual Server, /// 58- Windows File Archiver /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableRestoreAgentWithResult(long serverId, long agentId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Agent/" + (agentId.ToString()) + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableRestoreAgentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableRestoreAgentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableRestoreAgentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableRestoreAgent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableRestoreAgent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableRestoreAgent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="serverId">Id of the server to modify</param> /// <param name="agentId">Id of the agent to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableRestoreAgent_Validate(long serverId, long agentId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable restore property for commcell</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableRestoreCommcell(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableRestoreCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable restore property for commcell</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableRestoreCommcellWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableRestoreCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableRestoreCommcellWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableRestoreCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableRestoreCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableRestoreCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableRestoreCommcell" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableRestoreCommcell_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable restore property for an instance</summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableRestoreInstance(long instanceId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + (instanceId.ToString()) + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableRestoreInstance_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable restore property for an instance</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableRestoreInstanceViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Instance/(?<instanceId>[^/]+)/Restore/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Instance/{instanceId}/Restore/Action/Enable'"); } // replace URI parameters with values from identity var instanceId = _match.Groups["instanceId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + instanceId + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableRestoreInstance_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable restore property for an instance</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableRestoreInstanceViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Instance/(?<instanceId>[^/]+)/Restore/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Instance/{instanceId}/Restore/Action/Enable'"); } // replace URI parameters with values from identity var instanceId = _match.Groups["instanceId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + instanceId + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableRestoreInstanceWithResult_Call (request, eventListener,sender); } } /// <summary>Used to enable restore property for an instance</summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableRestoreInstanceWithResult(long instanceId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + (instanceId.ToString()) + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableRestoreInstanceWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableRestoreInstanceWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableRestoreInstanceWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableRestoreInstance" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableRestoreInstance_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableRestoreInstance" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableRestoreInstance_Validate(long instanceId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable restore property for Server</summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableRestoreServer(long serverId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableRestoreServer_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable restore property for a server group</summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableRestoreServerGroup(long serverGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableRestoreServerGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable restore property for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableRestoreServerGroupViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/Restore/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/Restore/Action/Enable'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableRestoreServerGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable restore property for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableRestoreServerGroupViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/Restore/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/Restore/Action/Enable'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableRestoreServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Used to enable restore property for a server group</summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableRestoreServerGroupWithResult(long serverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableRestoreServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableRestoreServerGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableRestoreServerGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableRestoreServerGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableRestoreServerGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableRestoreServerGroup" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="serverGroupId">Id of the serverGroup to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableRestoreServerGroup_Validate(long serverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable restore property for Server</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableRestoreServerViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Restore/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Restore/Action/Enable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableRestoreServer_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable restore property for Server</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableRestoreServerViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Server/(?<serverId>[^/]+)/Restore/Action/Enable$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Server/{serverId}/Restore/Action/Enable'"); } // replace URI parameters with values from identity var serverId = _match.Groups["serverId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + serverId + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableRestoreServerWithResult_Call (request, eventListener,sender); } } /// <summary>Used to enable restore property for Server</summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableRestoreServerWithResult(long serverId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Server/" + (serverId.ToString()) + "/Restore/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableRestoreServerWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableRestoreServerWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableRestoreServerWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableRestoreServer" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableRestoreServer_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableRestoreServer" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="serverId">Id of the Server whose details have to be modified</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableRestoreServer_Validate(long serverId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to enable scheduler property for commcell</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task EnableSchedulerCommcell(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Scheduler/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.EnableSchedulerCommcell_Call (request, onOk,eventListener,sender); } } /// <summary>Used to enable scheduler property for commcell</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableSchedulerCommcellWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Commcell/Scheduler/Action/Enable" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.EnableSchedulerCommcellWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "EnableSchedulerCommcellWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> EnableSchedulerCommcellWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "EnableSchedulerCommcell" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableSchedulerCommcell_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="EnableSchedulerCommcell" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task EnableSchedulerCommcell_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to exclude instance from SLA. Applicable for Salesforce & Office365</summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ExcludeSlaInstance(long instanceId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + (instanceId.ToString()) + "/SLA/Exclude" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ExcludeSlaInstance_Call (request, onOk,eventListener,sender); } } /// <summary>Used to exclude instance from SLA. Applicable for Salesforce & Office365</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ExcludeSlaInstanceViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Instance/(?<instanceId>[^/]+)/SLA/Exclude$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Instance/{instanceId}/SLA/Exclude'"); } // replace URI parameters with values from identity var instanceId = _match.Groups["instanceId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + instanceId + "/SLA/Exclude" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ExcludeSlaInstance_Call (request, onOk,eventListener,sender); } } /// <summary>Used to exclude instance from SLA. Applicable for Salesforce & Office365</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ExcludeSlaInstanceViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Instance/(?<instanceId>[^/]+)/SLA/Exclude$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Instance/{instanceId}/SLA/Exclude'"); } // replace URI parameters with values from identity var instanceId = _match.Groups["instanceId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + instanceId + "/SLA/Exclude" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ExcludeSlaInstanceWithResult_Call (request, eventListener,sender); } } /// <summary>Used to exclude instance from SLA. Applicable for Salesforce & Office365</summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ExcludeSlaInstanceWithResult(long instanceId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + (instanceId.ToString()) + "/SLA/Exclude" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ExcludeSlaInstanceWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ExcludeSlaInstanceWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ExcludeSlaInstanceWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "ExcludeSlaInstance" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ExcludeSlaInstance_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ExcludeSlaInstance" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ExcludeSlaInstance_Validate(long instanceId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Fetch(Read) Modfier details</summary> /// <param name="clusterId">Id of the cluster whose modifier has to be read.</param> /// <param name="modifierName">Name of the modifier to be read.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task FetchK8SModifier(long clusterId, string modifierName, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + (clusterId.ToString()) + "/Modifier/" + global::System.Uri.EscapeDataString(modifierName) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.FetchK8SModifier_Call (request, onOk,eventListener,sender); } } /// <summary>Fetch(Read) Modfier details</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task FetchK8SModifierViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Kubernetes/(?<clusterId>[^/]+)/Modifier/(?<ModifierName>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Kubernetes/{clusterId}/Modifier/{ModifierName}'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; var modifierName = _match.Groups["ModifierName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + clusterId + "/Modifier/" + modifierName ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.FetchK8SModifier_Call (request, onOk,eventListener,sender); } } /// <summary>Fetch(Read) Modfier details</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp> FetchK8SModifierViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Kubernetes/(?<clusterId>[^/]+)/Modifier/(?<ModifierName>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Kubernetes/{clusterId}/Modifier/{ModifierName}'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; var modifierName = _match.Groups["ModifierName"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + clusterId + "/Modifier/" + modifierName ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.FetchK8SModifierWithResult_Call (request, eventListener,sender); } } /// <summary>Fetch(Read) Modfier details</summary> /// <param name="clusterId">Id of the cluster whose modifier has to be read.</param> /// <param name="modifierName">Name of the modifier to be read.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp> FetchK8SModifierWithResult(long clusterId, string modifierName, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + (clusterId.ToString()) + "/Modifier/" + global::System.Uri.EscapeDataString(modifierName) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.FetchK8SModifierWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "FetchK8SModifierWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp> FetchK8SModifierWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.K8SRestoreModifierApiresp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "FetchK8SModifier" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task FetchK8SModifier_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.K8SRestoreModifierApiresp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="FetchK8SModifier" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="clusterId">Id of the cluster whose modifier has to be read.</param> /// <param name="modifierName">Name of the modifier to be read.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task FetchK8SModifier_Validate(long clusterId, string modifierName, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(modifierName),modifierName); } } /// <summary>Fetch local authentication details of the company</summary> /// <param name="companyId">Id of the company</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task FetchLocalAuthenticationDetilsOfCompany(long companyId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalAuthenticationDetailsResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/LocalAuthentication" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.FetchLocalAuthenticationDetilsOfCompany_Call (request, onOk,eventListener,sender); } } /// <summary>Fetch local authentication details of the company</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task FetchLocalAuthenticationDetilsOfCompanyViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalAuthenticationDetailsResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/LocalAuthentication$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/LocalAuthentication'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/LocalAuthentication" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.FetchLocalAuthenticationDetilsOfCompany_Call (request, onOk,eventListener,sender); } } /// <summary>Fetch local authentication details of the company</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalAuthenticationDetailsResponse>" /> /// that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalAuthenticationDetailsResponse> FetchLocalAuthenticationDetilsOfCompanyViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/LocalAuthentication$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/LocalAuthentication'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/LocalAuthentication" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.FetchLocalAuthenticationDetilsOfCompanyWithResult_Call (request, eventListener,sender); } } /// <summary>Fetch local authentication details of the company</summary> /// <param name="companyId">Id of the company</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalAuthenticationDetailsResponse>" /> /// that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalAuthenticationDetailsResponse> FetchLocalAuthenticationDetilsOfCompanyWithResult(long companyId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/LocalAuthentication" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.FetchLocalAuthenticationDetilsOfCompanyWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "FetchLocalAuthenticationDetilsOfCompanyWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalAuthenticationDetailsResponse>" /> /// that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalAuthenticationDetailsResponse> FetchLocalAuthenticationDetilsOfCompanyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.LocalAuthenticationDetailsResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "FetchLocalAuthenticationDetilsOfCompany" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task FetchLocalAuthenticationDetilsOfCompany_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalAuthenticationDetailsResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.LocalAuthenticationDetailsResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="FetchLocalAuthenticationDetilsOfCompany" /> method. Call this like the actual call, but /// you will get validation events back. /// </summary> /// <param name="companyId">Id of the company</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task FetchLocalAuthenticationDetilsOfCompany_Validate(long companyId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Fetches tape details based on the tape library Id provided</summary> /// <param name="libraryId">Id of the library to view the data</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task FetchTapeDetails(long libraryId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITapeDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + (libraryId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.FetchTapeDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Fetches tape details based on the tape library Id provided</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task FetchTapeDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITapeDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Tape/(?<libraryId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Tape/{libraryId}'"); } // replace URI parameters with values from identity var libraryId = _match.Groups["libraryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + libraryId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.FetchTapeDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "FetchTapeDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task FetchTapeDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITapeDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.TapeDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="FetchTapeDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="libraryId">Id of the library to view the data</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task FetchTapeDetails_Validate(long libraryId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Fetch tape media details based on the tape library Id</summary> /// <param name="libraryId">Id of the library to view the data</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task FetchTapeMediaDetails(long libraryId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITapeMediaDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + (libraryId.ToString()) + "/Media" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.FetchTapeMediaDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Fetch tape media details based on the tape library Id</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task FetchTapeMediaDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITapeMediaDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Tape/(?<libraryId>[^/]+)/Media$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Tape/{libraryId}/Media'"); } // replace URI parameters with values from identity var libraryId = _match.Groups["libraryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + libraryId + "/Media" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.FetchTapeMediaDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "FetchTapeMediaDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task FetchTapeMediaDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITapeMediaDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.TapeMediaDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="FetchTapeMediaDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="libraryId">Id of the library to view the data</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task FetchTapeMediaDetails_Validate(long libraryId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Gets owner permissions and laptop ownership details</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAccessControl(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAccessControl>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AccessControl" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAccessControl_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAccessControl" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAccessControl_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAccessControl>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AccessControl.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAccessControl" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAccessControl_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Endpoint to get the list of access nodes</summary> /// <param name="vendor">Vendor Name to be filtered</param> /// <param name="userId">user id to be filtered</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAccessNodes(string vendor, long? userId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAccessNodesList>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AccessNodes" + "?" + (string.IsNullOrEmpty(vendor) ? global::System.String.Empty : "vendor=" + global::System.Uri.EscapeDataString(vendor)) + "&" + (null == userId ? global::System.String.Empty : "userId=" + global::System.Uri.EscapeDataString(userId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAccessNodes_Call (request, onOk,eventListener,sender); } } /// <summary>Endpoint to get the list of access nodes</summary> /// <param name="viaIdentity"></param> /// <param name="vendor">Vendor Name to be filtered</param> /// <param name="userId">user id to be filtered</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAccessNodesViaIdentity(global::System.String viaIdentity, string vendor, long? userId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAccessNodesList>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AccessNodes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AccessNodes'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AccessNodes" + "?" + (string.IsNullOrEmpty(vendor) ? global::System.String.Empty : "vendor=" + global::System.Uri.EscapeDataString(vendor)) + "&" + (null == userId ? global::System.String.Empty : "userId=" + global::System.Uri.EscapeDataString(userId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAccessNodes_Call (request, onOk,eventListener,sender); } } /// <summary>Endpoint to get the list of access nodes</summary> /// <param name="viaIdentity"></param> /// <param name="vendor">Vendor Name to be filtered</param> /// <param name="userId">user id to be filtered</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAccessNodesList>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAccessNodesList> GetAccessNodesViaIdentityWithResult(global::System.String viaIdentity, string vendor, long? userId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AccessNodes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AccessNodes'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AccessNodes" + "?" + (string.IsNullOrEmpty(vendor) ? global::System.String.Empty : "vendor=" + global::System.Uri.EscapeDataString(vendor)) + "&" + (null == userId ? global::System.String.Empty : "userId=" + global::System.Uri.EscapeDataString(userId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAccessNodesWithResult_Call (request, eventListener,sender); } } /// <summary>Endpoint to get the list of access nodes</summary> /// <param name="vendor">Vendor Name to be filtered</param> /// <param name="userId">user id to be filtered</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAccessNodesList>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAccessNodesList> GetAccessNodesWithResult(string vendor, long? userId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AccessNodes" + "?" + (string.IsNullOrEmpty(vendor) ? global::System.String.Empty : "vendor=" + global::System.Uri.EscapeDataString(vendor)) + "&" + (null == userId ? global::System.String.Empty : "userId=" + global::System.Uri.EscapeDataString(userId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAccessNodesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAccessNodesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAccessNodesList>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAccessNodesList> GetAccessNodesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AccessNodesList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetAccessNodes" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAccessNodes_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAccessNodesList>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AccessNodesList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAccessNodes" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="vendor">Vendor Name to be filtered</param> /// <param name="userId">user id to be filtered</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAccessNodes_Validate(string vendor, long? userId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(vendor),vendor); } } /// <summary>Get Azure and OnPrem Active Directory clients with their file system state</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetActiveDirectoryClientsV2(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IActiveDirectoryClientsV2Resp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ActiveDirectory/Apps" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetActiveDirectoryClientsV2_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetActiveDirectoryClientsV2" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetActiveDirectoryClientsV2_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IActiveDirectoryClientsV2Resp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ActiveDirectoryClientsV2Resp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetActiveDirectoryClientsV2" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetActiveDirectoryClientsV2_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get detail of the AD/LDAP domain</summary> /// <param name="domainId">ID of the AD/LDAP domain</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAdldapDetails(long domainId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAdldapDetails>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LDAP/" + (domainId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAdldapDetails_Call (request, onOk,eventListener,sender); } } /// <summary>Get detail of the AD/LDAP domain</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAdldapDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAdldapDetails>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LDAP/(?<domainId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LDAP/{domainId}'"); } // replace URI parameters with values from identity var domainId = _match.Groups["domainId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LDAP/" + domainId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAdldapDetails_Call (request, onOk,eventListener,sender); } } /// <summary>Get detail of the AD/LDAP domain</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAdldapDetails>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAdldapDetails> GetAdldapDetailsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LDAP/(?<domainId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LDAP/{domainId}'"); } // replace URI parameters with values from identity var domainId = _match.Groups["domainId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LDAP/" + domainId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAdldapDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get detail of the AD/LDAP domain</summary> /// <param name="domainId">ID of the AD/LDAP domain</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAdldapDetails>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAdldapDetails> GetAdldapDetailsWithResult(long domainId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LDAP/" + (domainId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAdldapDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAdldapDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAdldapDetails>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAdldapDetails> GetAdldapDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AdldapDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetAdldapDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAdldapDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAdldapDetails>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AdldapDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAdldapDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="domainId">ID of the AD/LDAP domain</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAdldapDetails_Validate(long domainId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get aggregate count of entity</summary> /// <param name="globalSearchEntity">name of global search entity</param> /// <param name="fq">Filter criteria to filter out global search entities</param> /// <param name="groupBy">comma-separated list of entity response attributes based on which aggregate results would be grouped</param> /// <param name="func">aggregation function to be applied.</param> /// <param name="aggregateOn">attribute on which aggregation function would be applied.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAggregateOnEntity(string globalSearchEntity, string fq, string groupBy, string func, string aggregateOn, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalEntityAggregationValueResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/" + global::System.Uri.EscapeDataString(globalSearchEntity) + "/aggregate" + "?" + (string.IsNullOrEmpty(fq) ? global::System.String.Empty : "fq=" + global::System.Uri.EscapeDataString(fq)) + "&" + (string.IsNullOrEmpty(groupBy) ? global::System.String.Empty : "groupBy=" + global::System.Uri.EscapeDataString(groupBy)) + "&" + "func=" + global::System.Uri.EscapeDataString(func) + "&" + (string.IsNullOrEmpty(aggregateOn) ? global::System.String.Empty : "aggregateOn=" + global::System.Uri.EscapeDataString(aggregateOn)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAggregateOnEntity_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get aggregate count of entity</summary> /// <param name="viaIdentity"></param> /// <param name="fq">Filter criteria to filter out global search entities</param> /// <param name="groupBy">comma-separated list of entity response attributes based on which aggregate results would be grouped</param> /// <param name="func">aggregation function to be applied.</param> /// <param name="aggregateOn">attribute on which aggregation function would be applied.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAggregateOnEntityViaIdentity(global::System.String viaIdentity, string fq, string groupBy, string func, string aggregateOn, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalEntityAggregationValueResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/(?<globalSearchEntity>[^/]+)/aggregate$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/{globalSearchEntity}/aggregate'"); } // replace URI parameters with values from identity var globalSearchEntity = _match.Groups["globalSearchEntity"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/" + globalSearchEntity + "/aggregate" + "?" + (string.IsNullOrEmpty(fq) ? global::System.String.Empty : "fq=" + global::System.Uri.EscapeDataString(fq)) + "&" + (string.IsNullOrEmpty(groupBy) ? global::System.String.Empty : "groupBy=" + global::System.Uri.EscapeDataString(groupBy)) + "&" + "func=" + global::System.Uri.EscapeDataString(func) + "&" + (string.IsNullOrEmpty(aggregateOn) ? global::System.String.Empty : "aggregateOn=" + global::System.Uri.EscapeDataString(aggregateOn)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAggregateOnEntity_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get aggregate count of entity</summary> /// <param name="viaIdentity"></param> /// <param name="fq">Filter criteria to filter out global search entities</param> /// <param name="groupBy">comma-separated list of entity response attributes based on which aggregate results would be grouped</param> /// <param name="func">aggregation function to be applied.</param> /// <param name="aggregateOn">attribute on which aggregation function would be applied.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalEntityAggregationValueResp>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalEntityAggregationValueResp> GetAggregateOnEntityViaIdentityWithResult(global::System.String viaIdentity, string fq, string groupBy, string func, string aggregateOn, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/(?<globalSearchEntity>[^/]+)/aggregate$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/{globalSearchEntity}/aggregate'"); } // replace URI parameters with values from identity var globalSearchEntity = _match.Groups["globalSearchEntity"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/" + globalSearchEntity + "/aggregate" + "?" + (string.IsNullOrEmpty(fq) ? global::System.String.Empty : "fq=" + global::System.Uri.EscapeDataString(fq)) + "&" + (string.IsNullOrEmpty(groupBy) ? global::System.String.Empty : "groupBy=" + global::System.Uri.EscapeDataString(groupBy)) + "&" + "func=" + global::System.Uri.EscapeDataString(func) + "&" + (string.IsNullOrEmpty(aggregateOn) ? global::System.String.Empty : "aggregateOn=" + global::System.Uri.EscapeDataString(aggregateOn)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAggregateOnEntityWithResult_Call (request, eventListener,sender); } } /// <summary>Get aggregate count of entity</summary> /// <param name="globalSearchEntity">name of global search entity</param> /// <param name="fq">Filter criteria to filter out global search entities</param> /// <param name="groupBy">comma-separated list of entity response attributes based on which aggregate results would be grouped</param> /// <param name="func">aggregation function to be applied.</param> /// <param name="aggregateOn">attribute on which aggregation function would be applied.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalEntityAggregationValueResp>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalEntityAggregationValueResp> GetAggregateOnEntityWithResult(string globalSearchEntity, string fq, string groupBy, string func, string aggregateOn, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/" + global::System.Uri.EscapeDataString(globalSearchEntity) + "/aggregate" + "?" + (string.IsNullOrEmpty(fq) ? global::System.String.Empty : "fq=" + global::System.Uri.EscapeDataString(fq)) + "&" + (string.IsNullOrEmpty(groupBy) ? global::System.String.Empty : "groupBy=" + global::System.Uri.EscapeDataString(groupBy)) + "&" + "func=" + global::System.Uri.EscapeDataString(func) + "&" + (string.IsNullOrEmpty(aggregateOn) ? global::System.String.Empty : "aggregateOn=" + global::System.Uri.EscapeDataString(aggregateOn)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAggregateOnEntityWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAggregateOnEntityWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalEntityAggregationValueResp>" /> that /// will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalEntityAggregationValueResp> GetAggregateOnEntityWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GlobalEntityAggregationValueResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetAggregateOnEntity" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAggregateOnEntity_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalEntityAggregationValueResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GlobalEntityAggregationValueResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAggregateOnEntity" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="globalSearchEntity">name of global search entity</param> /// <param name="fq">Filter criteria to filter out global search entities</param> /// <param name="groupBy">comma-separated list of entity response attributes based on which aggregate results would be grouped</param> /// <param name="func">aggregation function to be applied.</param> /// <param name="aggregateOn">attribute on which aggregation function would be applied.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAggregateOnEntity_Validate(string globalSearchEntity, string fq, string groupBy, string func, string aggregateOn, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(globalSearchEntity),globalSearchEntity); await eventListener.AssertNotNull(nameof(fq),fq); await eventListener.AssertNotNull(nameof(groupBy),groupBy); await eventListener.AssertNotNull(nameof(func),func); await eventListener.AssertNotNull(nameof(aggregateOn),aggregateOn); } } /// <summary>Get the details of the custom alert rule by Id</summary> /// <param name="alertRuleId">Unique Id of the alert custom rule to get details</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAlertCustomRuleDetails(long alertRuleId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + (alertRuleId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAlertCustomRuleDetails_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get the details of the custom alert rule by Id</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAlertCustomRuleDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/Alert/CustomRule/(?<alertRuleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/Alert/CustomRule/{alertRuleId}'"); } // replace URI parameters with values from identity var alertRuleId = _match.Groups["alertRuleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + alertRuleId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAlertCustomRuleDetails_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get the details of the custom alert rule by Id</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList> GetAlertCustomRuleDetailsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/Alert/CustomRule/(?<alertRuleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/Alert/CustomRule/{alertRuleId}'"); } // replace URI parameters with values from identity var alertRuleId = _match.Groups["alertRuleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + alertRuleId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAlertCustomRuleDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get the details of the custom alert rule by Id</summary> /// <param name="alertRuleId">Unique Id of the alert custom rule to get details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList> GetAlertCustomRuleDetailsWithResult(long alertRuleId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule/" + (alertRuleId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAlertCustomRuleDetailsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetAlertCustomRuleDetailsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList> GetAlertCustomRuleDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertRulesDetailsList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetAlertCustomRuleDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAlertCustomRuleDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertRulesDetailsList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAlertCustomRuleDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="alertRuleId">Unique Id of the alert custom rule to get details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAlertCustomRuleDetails_Validate(long alertRuleId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the list of alert custom rules</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAlertCustomRulesList(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAlertCustomRulesList_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get the list of alert custom rules</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList> GetAlertCustomRulesListWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/Alert/CustomRule" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAlertCustomRulesListWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAlertCustomRulesListWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList> GetAlertCustomRulesListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertRulesDetailsList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetAlertCustomRulesList" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAlertCustomRulesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertRulesDetailsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertRulesDetailsList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAlertCustomRulesList" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAlertCustomRulesList_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details of alert definition</summary> /// <param name="id"></param> /// <param name="additionalProperties"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAlertDefinitionsDetails(long id, bool? additionalProperties, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + (id.ToString()) + "?" + (null == additionalProperties ? global::System.String.Empty : "additionalProperties=" + global::System.Uri.EscapeDataString(additionalProperties.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAlertDefinitionsDetails_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get details of alert definition</summary> /// <param name="viaIdentity"></param> /// <param name="additionalProperties"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAlertDefinitionsDetailsViaIdentity(global::System.String viaIdentity, bool? additionalProperties, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AlertDefinitions/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AlertDefinitions/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + id + "?" + (null == additionalProperties ? global::System.String.Empty : "additionalProperties=" + global::System.Uri.EscapeDataString(additionalProperties.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAlertDefinitionsDetails_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get details of alert definition</summary> /// <param name="viaIdentity"></param> /// <param name="additionalProperties"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsDetails>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsDetails> GetAlertDefinitionsDetailsViaIdentityWithResult(global::System.String viaIdentity, bool? additionalProperties, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AlertDefinitions/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AlertDefinitions/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + id + "?" + (null == additionalProperties ? global::System.String.Empty : "additionalProperties=" + global::System.Uri.EscapeDataString(additionalProperties.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAlertDefinitionsDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get details of alert definition</summary> /// <param name="id"></param> /// <param name="additionalProperties"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsDetails>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsDetails> GetAlertDefinitionsDetailsWithResult(long id, bool? additionalProperties, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions/" + (id.ToString()) + "?" + (null == additionalProperties ? global::System.String.Empty : "additionalProperties=" + global::System.Uri.EscapeDataString(additionalProperties.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAlertDefinitionsDetailsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetAlertDefinitionsDetailsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsDetails>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsDetails> GetAlertDefinitionsDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertDefinitionsDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetAlertDefinitionsDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAlertDefinitionsDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertDefinitionsDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAlertDefinitionsDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="id"></param> /// <param name="additionalProperties"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAlertDefinitionsDetails_Validate(long id, bool? additionalProperties, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the list of Alert Definitions</summary> /// <param name="additionalProperties">To get extra meta data details for the api</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAlertDefinitionsList(bool? additionalProperties, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions" + "?" + (null == additionalProperties ? global::System.String.Empty : "additionalProperties=" + global::System.Uri.EscapeDataString(additionalProperties.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAlertDefinitionsList_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get the list of Alert Definitions</summary> /// <param name="viaIdentity"></param> /// <param name="additionalProperties">To get extra meta data details for the api</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAlertDefinitionsListViaIdentity(global::System.String viaIdentity, bool? additionalProperties, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AlertDefinitions$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AlertDefinitions'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions" + "?" + (null == additionalProperties ? global::System.String.Empty : "additionalProperties=" + global::System.Uri.EscapeDataString(additionalProperties.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAlertDefinitionsList_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get the list of Alert Definitions</summary> /// <param name="viaIdentity"></param> /// <param name="additionalProperties">To get extra meta data details for the api</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsList>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsList> GetAlertDefinitionsListViaIdentityWithResult(global::System.String viaIdentity, bool? additionalProperties, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AlertDefinitions$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AlertDefinitions'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions" + "?" + (null == additionalProperties ? global::System.String.Empty : "additionalProperties=" + global::System.Uri.EscapeDataString(additionalProperties.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAlertDefinitionsListWithResult_Call (request, eventListener,sender); } } /// <summary>Get the list of Alert Definitions</summary> /// <param name="additionalProperties">To get extra meta data details for the api</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsList>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsList> GetAlertDefinitionsListWithResult(bool? additionalProperties, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertDefinitions" + "?" + (null == additionalProperties ? global::System.String.Empty : "additionalProperties=" + global::System.Uri.EscapeDataString(additionalProperties.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAlertDefinitionsListWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAlertDefinitionsListWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsList>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsList> GetAlertDefinitionsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertDefinitionsList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetAlertDefinitionsList" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAlertDefinitionsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertDefinitionsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertDefinitionsList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAlertDefinitionsList" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="additionalProperties">To get extra meta data details for the api</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAlertDefinitionsList_Validate(bool? additionalProperties, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the list of alert types and alert custom rules</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAlertType(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertTypeResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertType" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAlertType_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get the list of alert types and alert custom rules</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertTypeResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertTypeResp> GetAlertTypeWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AlertType" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAlertTypeWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAlertTypeWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertTypeResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertTypeResp> GetAlertTypeWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertTypeResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetAlertType" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAlertType_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertTypeResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertTypeResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAlertType" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAlertType_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get List Of Alerts Triggered</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAlertsTriggered(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertsTriggeredListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAlertsTriggered_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get List Of Alerts Triggered</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertsTriggeredListResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertsTriggeredListResp> GetAlertsTriggeredWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAlertsTriggeredWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAlertsTriggeredWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertsTriggeredListResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertsTriggeredListResp> GetAlertsTriggeredWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertsTriggeredListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetAlertsTriggered" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAlertsTriggered_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAlertsTriggeredListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AlertsTriggeredListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAlertsTriggered" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAlertsTriggered_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the details of all applicationGroups</summary> /// <param name="clusterId">Id of the hypervisor to list application groups</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAllAPllicationGroups(long? clusterId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IApplicationGroupListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/ApplicationGroups" + "?" + (null == clusterId ? global::System.String.Empty : "ClusterId=" + global::System.Uri.EscapeDataString(clusterId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAllAPllicationGroups_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get the details of all applicationGroups</summary> /// <param name="viaIdentity"></param> /// <param name="clusterId">Id of the hypervisor to list application groups</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAllAPllicationGroupsViaIdentity(global::System.String viaIdentity, long? clusterId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IApplicationGroupListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Kubernetes/ApplicationGroups$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Kubernetes/ApplicationGroups'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/ApplicationGroups" + "?" + (null == clusterId ? global::System.String.Empty : "ClusterId=" + global::System.Uri.EscapeDataString(clusterId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAllAPllicationGroups_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAllAPllicationGroups" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAllAPllicationGroups_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IApplicationGroupListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ApplicationGroupListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAllAPllicationGroups" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="clusterId">Id of the hypervisor to list application groups</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAllAPllicationGroups_Validate(long? clusterId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get all Kubernetes application groups</summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client to filter Application Groups for</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAllKubernetesAppGroups(long? clusterId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetApplicationGroupsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup" + "?" + (null == clusterId ? global::System.String.Empty : "clusterId=" + global::System.Uri.EscapeDataString(clusterId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAllKubernetesAppGroups_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>API to get all Kubernetes application groups</summary> /// <param name="viaIdentity"></param> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client to filter Application Groups for</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAllKubernetesAppGroupsViaIdentity(global::System.String viaIdentity, long? clusterId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetApplicationGroupsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/ApplicationGroup$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/ApplicationGroup'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup" + "?" + (null == clusterId ? global::System.String.Empty : "clusterId=" + global::System.Uri.EscapeDataString(clusterId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAllKubernetesAppGroups_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAllKubernetesAppGroups" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAllKubernetesAppGroups_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetApplicationGroupsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetApplicationGroupsList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAllKubernetesAppGroups" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client to filter Application Groups for</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAllKubernetesAppGroups_Validate(long? clusterId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get all Kubernetes applications</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAllKubernetesApps(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetApplicationsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Application" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAllKubernetesApps_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAllKubernetesApps" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAllKubernetesApps_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetApplicationsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetApplicationsList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAllKubernetesApps" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAllKubernetesApps_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get all Kubernetes clusters</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAllKubernetesClustersOp(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAllKubernetesClustersOp_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAllKubernetesClustersOp" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAllKubernetesClustersOp_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetClusterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetClusterResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAllKubernetesClustersOp" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAllKubernetesClustersOp_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the details of all vmGroup</summary> /// <param name="hypervisorId">Id of the hypervisor to list vm groups</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAllVMGroups(long? hypervisorId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsK929ZxV4VmgroupsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VMGroups" + "?" + (null == hypervisorId ? global::System.String.Empty : "hypervisorId=" + global::System.Uri.EscapeDataString(hypervisorId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAllVMGroups_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get the details of all vmGroup</summary> /// <param name="viaIdentity"></param> /// <param name="hypervisorId">Id of the hypervisor to list vm groups</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAllVMGroupsViaIdentity(global::System.String viaIdentity, long? hypervisorId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsK929ZxV4VmgroupsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VMGroups$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VMGroups'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VMGroups" + "?" + (null == hypervisorId ? global::System.String.Empty : "hypervisorId=" + global::System.Uri.EscapeDataString(hypervisorId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAllVMGroups_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAllVMGroups" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAllVMGroups_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsK929ZxV4VmgroupsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PathsK929ZxV4VmgroupsGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAllVMGroups" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="hypervisorId">Id of the hypervisor to list vm groups</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAllVMGroups_Validate(long? hypervisorId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get anomalous audits in the specified time</summary> /// <param name="fromTime">Anomalous audits from a specific time (in epochs)</param> /// <param name="toTime">Anomalous audits till a specific time (in epochs)</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAnomalousAudits(long? fromTime, long? toTime, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAnomalousAuditsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AnomalousAudits" + "?" + (null == fromTime ? global::System.String.Empty : "fromTime=" + global::System.Uri.EscapeDataString(fromTime.ToString())) + "&" + (null == toTime ? global::System.String.Empty : "toTime=" + global::System.Uri.EscapeDataString(toTime.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAnomalousAudits_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get anomalous audits in the specified time</summary> /// <param name="viaIdentity"></param> /// <param name="fromTime">Anomalous audits from a specific time (in epochs)</param> /// <param name="toTime">Anomalous audits till a specific time (in epochs)</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAnomalousAuditsViaIdentity(global::System.String viaIdentity, long? fromTime, long? toTime, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAnomalousAuditsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AnomalousAudits$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AnomalousAudits'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AnomalousAudits" + "?" + (null == fromTime ? global::System.String.Empty : "fromTime=" + global::System.Uri.EscapeDataString(fromTime.ToString())) + "&" + (null == toTime ? global::System.String.Empty : "toTime=" + global::System.Uri.EscapeDataString(toTime.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAnomalousAudits_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAnomalousAudits" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAnomalousAudits_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAnomalousAuditsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AnomalousAuditsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAnomalousAudits" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="fromTime">Anomalous audits from a specific time (in epochs)</param> /// <param name="toTime">Anomalous audits till a specific time (in epochs)</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAnomalousAudits_Validate(long? fromTime, long? toTime, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// Get various anomalous conditions like events, jobs, offline clients, high CPU and memory loaded clients /// </summary> /// <param name="fromTime">unix time stamp denotes from which the anomalous events should be retrieved</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAnomalousConditions(string fromTime, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths16JaxnbV4AnomalousconditionsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AnomalousConditions" + "?" + "fromTime=" + global::System.Uri.EscapeDataString(fromTime) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAnomalousConditions_Call (request, onOk,eventListener,sender); } } /// <summary> /// Get various anomalous conditions like events, jobs, offline clients, high CPU and memory loaded clients /// </summary> /// <param name="viaIdentity"></param> /// <param name="fromTime">unix time stamp denotes from which the anomalous events should be retrieved</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAnomalousConditionsViaIdentity(global::System.String viaIdentity, string fromTime, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths16JaxnbV4AnomalousconditionsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AnomalousConditions$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AnomalousConditions'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AnomalousConditions" + "?" + "fromTime=" + global::System.Uri.EscapeDataString(fromTime) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAnomalousConditions_Call (request, onOk,eventListener,sender); } } /// <summary> /// Get various anomalous conditions like events, jobs, offline clients, high CPU and memory loaded clients /// </summary> /// <param name="viaIdentity"></param> /// <param name="fromTime">unix time stamp denotes from which the anomalous events should be retrieved</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths16JaxnbV4AnomalousconditionsGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths16JaxnbV4AnomalousconditionsGetResponses200ContentApplicationJsonSchema> GetAnomalousConditionsViaIdentityWithResult(global::System.String viaIdentity, string fromTime, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/AnomalousConditions$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/AnomalousConditions'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AnomalousConditions" + "?" + "fromTime=" + global::System.Uri.EscapeDataString(fromTime) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAnomalousConditionsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Get various anomalous conditions like events, jobs, offline clients, high CPU and memory loaded clients /// </summary> /// <param name="fromTime">unix time stamp denotes from which the anomalous events should be retrieved</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths16JaxnbV4AnomalousconditionsGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths16JaxnbV4AnomalousconditionsGetResponses200ContentApplicationJsonSchema> GetAnomalousConditionsWithResult(string fromTime, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AnomalousConditions" + "?" + "fromTime=" + global::System.Uri.EscapeDataString(fromTime) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAnomalousConditionsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAnomalousConditionsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths16JaxnbV4AnomalousconditionsGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths16JaxnbV4AnomalousconditionsGetResponses200ContentApplicationJsonSchema> GetAnomalousConditionsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths16JaxnbV4AnomalousconditionsGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetAnomalousConditions" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAnomalousConditions_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths16JaxnbV4AnomalousconditionsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths16JaxnbV4AnomalousconditionsGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAnomalousConditions" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="fromTime">unix time stamp denotes from which the anomalous events should be retrieved</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAnomalousConditions_Validate(string fromTime, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(fromTime),fromTime); } } /// <summary>API to get details of a Kubernetes application group with applicationGroupId</summary> /// <param name="applicationGroupId">applicationGroupId is the ID of the Kubernetes application group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetApplicationGroupDetails(long applicationGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetApplicationGroupDetails>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + (applicationGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetApplicationGroupDetails_Call (request, onOk,eventListener,sender); } } /// <summary>API to get details of a Kubernetes application group with applicationGroupId</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetApplicationGroupDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetApplicationGroupDetails>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/ApplicationGroup/(?<applicationGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/ApplicationGroup/{applicationGroupId}'"); } // replace URI parameters with values from identity var applicationGroupId = _match.Groups["applicationGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + applicationGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetApplicationGroupDetails_Call (request, onOk,eventListener,sender); } } /// <summary>API to get details of a Kubernetes application group with applicationGroupId</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetApplicationGroupDetails>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetApplicationGroupDetails> GetApplicationGroupDetailsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/ApplicationGroup/(?<applicationGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/ApplicationGroup/{applicationGroupId}'"); } // replace URI parameters with values from identity var applicationGroupId = _match.Groups["applicationGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + applicationGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetApplicationGroupDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>API to get details of a Kubernetes application group with applicationGroupId</summary> /// <param name="applicationGroupId">applicationGroupId is the ID of the Kubernetes application group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetApplicationGroupDetails>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetApplicationGroupDetails> GetApplicationGroupDetailsWithResult(long applicationGroupId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + (applicationGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetApplicationGroupDetailsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetApplicationGroupDetailsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetApplicationGroupDetails>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetApplicationGroupDetails> GetApplicationGroupDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetApplicationGroupDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetApplicationGroupDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetApplicationGroupDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetApplicationGroupDetails>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetApplicationGroupDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetApplicationGroupDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="applicationGroupId">applicationGroupId is the ID of the Kubernetes application group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetApplicationGroupDetails_Validate(long applicationGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get Backup Destinations for a Plan</summary> /// <param name="planId">Id of the Archive Plan to retrieve backup destinations</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetArchiveBackupDestinations(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchivePlanBackupDestinations>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) + "/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetArchiveBackupDestinations_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get Backup Destinations for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetArchiveBackupDestinationsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchivePlanBackupDestinations>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)/BackupDestinations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}/BackupDestinations'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId + "/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetArchiveBackupDestinations_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get Backup Destinations for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchivePlanBackupDestinations>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchivePlanBackupDestinations> GetArchiveBackupDestinationsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)/BackupDestinations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}/BackupDestinations'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId + "/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetArchiveBackupDestinationsWithResult_Call (request, eventListener,sender); } } /// <summary>Get Backup Destinations for a Plan</summary> /// <param name="planId">Id of the Archive Plan to retrieve backup destinations</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchivePlanBackupDestinations>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchivePlanBackupDestinations> GetArchiveBackupDestinationsWithResult(long planId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) + "/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetArchiveBackupDestinationsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetArchiveBackupDestinationsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchivePlanBackupDestinations>" /> that /// will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchivePlanBackupDestinations> GetArchiveBackupDestinationsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ArchivePlanBackupDestinations.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetArchiveBackupDestinations" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetArchiveBackupDestinations_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchivePlanBackupDestinations>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ArchivePlanBackupDestinations.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetArchiveBackupDestinations" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="planId">Id of the Archive Plan to retrieve backup destinations</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetArchiveBackupDestinations_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>This endpoint is used to return the list of Archive file servers.</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetArchiveFileServers(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchiveFileServers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetArchiveFileServers_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>This endpoint is used to return the list of Archive file servers.</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp> GetArchiveFileServersWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchiveFileServers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetArchiveFileServersWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetArchiveFileServersWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp> GetArchiveFileServersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.FileServerListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetArchiveFileServers" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetArchiveFileServers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.FileServerListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetArchiveFileServers" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetArchiveFileServers_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get Archive Plan details</summary> /// <param name="planId">Id of the plan</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetArchivePlanById(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchivePlanDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetArchivePlanById_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get Archive Plan details</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetArchivePlanByIdViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchivePlanDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetArchivePlanById_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetArchivePlanById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetArchivePlanById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArchivePlanDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ArchivePlanDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetArchivePlanById" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetArchivePlanById_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Getting Array Details</summary> /// <param name="arrayId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetArrayDetails(long arrayId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArrayDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetArrayDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Getting Array Details</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetArrayDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArrayDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetArrayDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Getting Array Details</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArrayDetails>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArrayDetails> GetArrayDetailsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetArrayDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Getting Array Details</summary> /// <param name="arrayId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArrayDetails>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArrayDetails> GetArrayDetailsWithResult(long arrayId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetArrayDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetArrayDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArrayDetails>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArrayDetails> GetArrayDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ArrayDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetArrayDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetArrayDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArrayDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ArrayDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetArrayDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="arrayId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetArrayDetails_Validate(long arrayId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get Array Replication Pair information</summary> /// <param name="failoverGroupId">The ID of the failover group associated to array replication pairs</param> /// <param name="replicationId">The ID of the array replication pair</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetArrayReplicationMonitor(long? failoverGroupId, long? replicationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArrayReplicationMonitorResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArrayReplicationMonitor" + "?" + (null == failoverGroupId ? global::System.String.Empty : "failoverGroupId=" + global::System.Uri.EscapeDataString(failoverGroupId.ToString())) + "&" + (null == replicationId ? global::System.String.Empty : "replicationId=" + global::System.Uri.EscapeDataString(replicationId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetArrayReplicationMonitor_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get Array Replication Pair information</summary> /// <param name="viaIdentity"></param> /// <param name="failoverGroupId">The ID of the failover group associated to array replication pairs</param> /// <param name="replicationId">The ID of the array replication pair</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetArrayReplicationMonitorViaIdentity(global::System.String viaIdentity, long? failoverGroupId, long? replicationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArrayReplicationMonitorResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArrayReplicationMonitor$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArrayReplicationMonitor'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArrayReplicationMonitor" + "?" + (null == failoverGroupId ? global::System.String.Empty : "failoverGroupId=" + global::System.Uri.EscapeDataString(failoverGroupId.ToString())) + "&" + (null == replicationId ? global::System.String.Empty : "replicationId=" + global::System.Uri.EscapeDataString(replicationId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetArrayReplicationMonitor_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetArrayReplicationMonitor" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetArrayReplicationMonitor_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IArrayReplicationMonitorResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ArrayReplicationMonitorResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetArrayReplicationMonitor" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="failoverGroupId">The ID of the failover group associated to array replication pairs</param> /// <param name="replicationId">The ID of the array replication pair</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetArrayReplicationMonitor_Validate(long? failoverGroupId, long? replicationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get all storage arrays.</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetArrays(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetArrays_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Get all storage arrays.</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp> GetArraysWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetArraysWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetArraysWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp> GetArraysWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetArraysResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetArrays" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetArrays_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetArraysResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetArrays" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetArrays_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get list of associated media agents detail for a Plan</summary> /// <param name="planId">Plan id of the plan</param> /// <param name="packageName">Provide the name of the package that needs to be checked if installed on the Media Agents. isPackageInstalled /// will be populated accordingly. By default it checks for Media agent package. Refer to packageName list.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAssocMAsForPlan(long planId, string packageName, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAssociatedMAsForPlanResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + (planId.ToString()) + "/MediaAgents" + "?" + (string.IsNullOrEmpty(packageName) ? global::System.String.Empty : "packageName=" + global::System.Uri.EscapeDataString(packageName)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAssocMAsForPlan_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Get list of associated media agents detail for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="packageName">Provide the name of the package that needs to be checked if installed on the Media Agents. isPackageInstalled /// will be populated accordingly. By default it checks for Media agent package. Refer to packageName list.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAssocMAsForPlanViaIdentity(global::System.String viaIdentity, string packageName, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAssociatedMAsForPlanResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/(?<planId>[^/]+)/MediaAgents$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/{planId}/MediaAgents'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + planId + "/MediaAgents" + "?" + (string.IsNullOrEmpty(packageName) ? global::System.String.Empty : "packageName=" + global::System.Uri.EscapeDataString(packageName)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAssocMAsForPlan_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetAssocMAsForPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAssocMAsForPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAssociatedMAsForPlanResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AssociatedMAsForPlanResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAssocMAsForPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Plan id of the plan</param> /// <param name="packageName">Provide the name of the package that needs to be checked if installed on the Media Agents. isPackageInstalled /// will be populated accordingly. By default it checks for Media agent package. Refer to packageName list.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAssocMAsForPlan_Validate(long planId, string packageName, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(packageName),packageName); } } /// <summary>API to get list of association for a company</summary> /// <param name="companyId">Id of the Company whose associations have to be fetched</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAssociationsForCompany(long companyId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAssociationsForCompanyResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/associations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAssociationsForCompany_Call (request, onOk,onBadRequest,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>API to get list of association for a company</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetAssociationsForCompanyViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAssociationsForCompanyResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/associations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/associations'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/associations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetAssociationsForCompany_Call (request, onOk,onBadRequest,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>API to get list of association for a company</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAssociationsForCompanyResp>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAssociationsForCompanyResp> GetAssociationsForCompanyViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/associations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/associations'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/associations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAssociationsForCompanyWithResult_Call (request, eventListener,sender); } } /// <summary>API to get list of association for a company</summary> /// <param name="companyId">Id of the Company whose associations have to be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAssociationsForCompanyResp>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAssociationsForCompanyResp> GetAssociationsForCompanyWithResult(long companyId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/associations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetAssociationsForCompanyWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetAssociationsForCompanyWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAssociationsForCompanyResp>" /> that /// will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAssociationsForCompanyResp> GetAssociationsForCompanyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetAssociationsForCompanyResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetAssociationsForCompany" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAssociationsForCompany_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAssociationsForCompanyResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetAssociationsForCompanyResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetAssociationsForCompany" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="companyId">Id of the Company whose associations have to be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetAssociationsForCompany_Validate(long companyId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// Get all the associated server/server groups and included/excluded entities of backupdestination. It will also return summary /// of all the entities that will be auxcopied for backupdestination. /// </summary> /// <param name="planId"></param> /// <param name="backupDestinationId"></param> /// <param name="entityType">It is to further filter and get all the child entities of given entityType/entityId associated /// with backupdestination.</param> /// <param name="entityId">It is to further filter and get all the child entities of given entityType/entityId associated /// with backupdestination.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBackupDestinationClientAssociations(long planId, long backupDestinationId, long? entityType, long? entityId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupDestinationAssociationsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) + "/Associations" + "?" + (null == entityType ? global::System.String.Empty : "entityType=" + global::System.Uri.EscapeDataString(entityType.ToString())) + "&" + (null == entityId ? global::System.String.Empty : "entityId=" + global::System.Uri.EscapeDataString(entityId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBackupDestinationClientAssociations_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary> /// Get all the associated server/server groups and included/excluded entities of backupdestination. It will also return summary /// of all the entities that will be auxcopied for backupdestination. /// </summary> /// <param name="viaIdentity"></param> /// <param name="entityType">It is to further filter and get all the child entities of given entityType/entityId associated /// with backupdestination.</param> /// <param name="entityId">It is to further filter and get all the child entities of given entityType/entityId associated /// with backupdestination.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBackupDestinationClientAssociationsViaIdentity(global::System.String viaIdentity, long? entityType, long? entityId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupDestinationAssociationsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/(?<planId>[^/]+)/BackupDestination/(?<backupDestinationId>[^/]+)/Associations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/{planId}/BackupDestination/{backupDestinationId}/Associations'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["backupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + planId + "/BackupDestination/" + backupDestinationId + "/Associations" + "?" + (null == entityType ? global::System.String.Empty : "entityType=" + global::System.Uri.EscapeDataString(entityType.ToString())) + "&" + (null == entityId ? global::System.String.Empty : "entityId=" + global::System.Uri.EscapeDataString(entityId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBackupDestinationClientAssociations_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetBackupDestinationClientAssociations" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBackupDestinationClientAssociations_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupDestinationAssociationsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.BackupDestinationAssociationsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetBackupDestinationClientAssociations" /> method. Call this like the actual call, but /// you will get validation events back. /// </summary> /// <param name="planId"></param> /// <param name="backupDestinationId"></param> /// <param name="entityType">It is to further filter and get all the child entities of given entityType/entityId associated /// with backupdestination.</param> /// <param name="entityId">It is to further filter and get all the child entities of given entityType/entityId associated /// with backupdestination.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBackupDestinationClientAssociations_Validate(long planId, long backupDestinationId, long? entityType, long? entityId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get specific backup destination details for a server plan</summary> /// <param name="planId">Id of the plan to retrieve backup destination</param> /// <param name="backupDestinationId">Id of the backup destination</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBackupDestinationDetails(long planId, long backupDestinationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/ServerPlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBackupDestinationDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get specific backup destination details for a server plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBackupDestinationDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/ServerPlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/ServerPlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/ServerPlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBackupDestinationDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get specific backup destination details for a server plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationDetails>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationDetails> GetBackupDestinationDetailsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/ServerPlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/ServerPlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/ServerPlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetBackupDestinationDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get specific backup destination details for a server plan</summary> /// <param name="planId">Id of the plan to retrieve backup destination</param> /// <param name="backupDestinationId">Id of the backup destination</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationDetails>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationDetails> GetBackupDestinationDetailsWithResult(long planId, long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/ServerPlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetBackupDestinationDetailsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetBackupDestinationDetailsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationDetails>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationDetails> GetBackupDestinationDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Fetch details of a backup destination. /// </summary> /// <param name="backupDestinationId">Id of the backupDestination for which details will be fetched.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBackupDestinationDetailsWithoutPlanInfo(long backupDestinationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupDestination>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBackupDestinationDetailsWithoutPlanInfo_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary> /// Fetch details of a backup destination. /// </summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBackupDestinationDetailsWithoutPlanInfoViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupDestination>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBackupDestinationDetailsWithoutPlanInfo_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary> /// Fetch details of a backup destination. /// </summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupDestination>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupDestination> GetBackupDestinationDetailsWithoutPlanInfoViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetBackupDestinationDetailsWithoutPlanInfoWithResult_Call (request, eventListener,sender); } } /// <summary> /// Fetch details of a backup destination. /// </summary> /// <param name="backupDestinationId">Id of the backupDestination for which details will be fetched.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupDestination>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupDestination> GetBackupDestinationDetailsWithoutPlanInfoWithResult(long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetBackupDestinationDetailsWithoutPlanInfoWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetBackupDestinationDetailsWithoutPlanInfoWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupDestination>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupDestination> GetBackupDestinationDetailsWithoutPlanInfoWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.BackupDestination.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "GetBackupDestinationDetailsWithoutPlanInfo" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBackupDestinationDetailsWithoutPlanInfo_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupDestination>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.BackupDestination.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetBackupDestinationDetailsWithoutPlanInfo" /> method. Call this like the actual call, /// but you will get validation events back. /// </summary> /// <param name="backupDestinationId">Id of the backupDestination for which details will be fetched.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBackupDestinationDetailsWithoutPlanInfo_Validate(long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Actual wire call for <see cref= "GetBackupDestinationDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBackupDestinationDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetBackupDestinationDetails" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="planId">Id of the plan to retrieve backup destination</param> /// <param name="backupDestinationId">Id of the backup destination</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBackupDestinationDetails_Validate(long planId, long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get Backup Destinations for a Plan</summary> /// <param name="planId">Id of the Plan to retrieve backup destinations</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBackupDestinations(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBackupDestinations_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get Backup Destinations for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBackupDestinationsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/BackupDestinations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/BackupDestinations'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBackupDestinations_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get Backup Destinations for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations> GetBackupDestinationsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/BackupDestinations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/BackupDestinations'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetBackupDestinationsWithResult_Call (request, eventListener,sender); } } /// <summary>Get Backup Destinations for a Plan</summary> /// <param name="planId">Id of the Plan to retrieve backup destinations</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations> GetBackupDestinationsWithResult(long planId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetBackupDestinationsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetBackupDestinationsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations> GetBackupDestinationsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinations.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetBackupDestinations" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBackupDestinations_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinations.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetBackupDestinations" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the Plan to retrieve backup destinations</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBackupDestinations_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to fetch mount path details of the disk storage pool</summary> /// <param name="storagePoolId">Id of the disk storage pool whose details have to be fetched</param> /// <param name="backupLocationId">Id of the backup location whose details have to be fetched</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBackupLocationDetails(long storagePoolId, long backupLocationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBackupLocationDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to fetch mount path details of the disk storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBackupLocationDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation/{backupLocationId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation/" + backupLocationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBackupLocationDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to fetch mount path details of the disk storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails> GetBackupLocationDetailsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation/{backupLocationId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation/" + backupLocationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetBackupLocationDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Used to fetch mount path details of the disk storage pool</summary> /// <param name="storagePoolId">Id of the disk storage pool whose details have to be fetched</param> /// <param name="backupLocationId">Id of the backup location whose details have to be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails> GetBackupLocationDetailsWithResult(long storagePoolId, long backupLocationId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetBackupLocationDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetBackupLocationDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails> GetBackupLocationDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.BackupLocationDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetBackupLocationDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBackupLocationDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.BackupLocationDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetBackupLocationDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="storagePoolId">Id of the disk storage pool whose details have to be fetched</param> /// <param name="backupLocationId">Id of the backup location whose details have to be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBackupLocationDetails_Validate(long storagePoolId, long backupLocationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>This endpoint is used to return the list of big data apps.</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBigDataList(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBigDataAppListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BigDataApps" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBigDataList_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>This endpoint is used to return the list of big data apps.</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBigDataAppListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBigDataAppListResp> GetBigDataListWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BigDataApps" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetBigDataListWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetBigDataListWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBigDataAppListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBigDataAppListResp> GetBigDataListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.BigDataAppListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetBigDataList" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBigDataList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBigDataAppListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.BigDataAppListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetBigDataList" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBigDataList_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details of a blackout window based on id</summary> /// <param name="blackoutWindowId">Id of the Blackout Window whose details have to be fetched</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBlackoutWindowDetails(long blackoutWindowId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindow>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/BlackoutWindow/" + (blackoutWindowId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBlackoutWindowDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a blackout window based on id</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBlackoutWindowDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindow>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/BlackoutWindow/(?<blackoutWindowId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/BlackoutWindow/{blackoutWindowId}'"); } // replace URI parameters with values from identity var blackoutWindowId = _match.Groups["blackoutWindowId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/BlackoutWindow/" + blackoutWindowId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBlackoutWindowDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a blackout window based on id</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindow>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindow> GetBlackoutWindowDetailsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/BlackoutWindow/(?<blackoutWindowId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/BlackoutWindow/{blackoutWindowId}'"); } // replace URI parameters with values from identity var blackoutWindowId = _match.Groups["blackoutWindowId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/BlackoutWindow/" + blackoutWindowId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetBlackoutWindowDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get details of a blackout window based on id</summary> /// <param name="blackoutWindowId">Id of the Blackout Window whose details have to be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindow>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindow> GetBlackoutWindowDetailsWithResult(long blackoutWindowId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/BlackoutWindow/" + (blackoutWindowId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetBlackoutWindowDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetBlackoutWindowDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindow>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindow> GetBlackoutWindowDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.BlackoutWindow.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetBlackoutWindowDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBlackoutWindowDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindow>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.BlackoutWindow.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetBlackoutWindowDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="blackoutWindowId">Id of the Blackout Window whose details have to be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBlackoutWindowDetails_Validate(long blackoutWindowId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get All Blackout Windows</summary> /// <param name="showOnlyCommcellLevel">Shows blackout window at commcell level if set to true.</param> /// <param name="companyId">Shows blackout windows associated with the company whose id has been provided.</param> /// <param name="serverGroupId">Shows blackout windows associated with the server group whose id has been provided.</param> /// <param name="commcellId">Shows blackout windows associated with the commcell whose id has been provided.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBlackoutWindows(bool? showOnlyCommcellLevel, long? companyId, long? serverGroupId, string commcellId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindowsListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/BlackoutWindow" + "?" + (null == showOnlyCommcellLevel ? global::System.String.Empty : "showOnlyCommcellLevel=" + global::System.Uri.EscapeDataString(showOnlyCommcellLevel.ToString())) + "&" + (null == companyId ? global::System.String.Empty : "companyId=" + global::System.Uri.EscapeDataString(companyId.ToString())) + "&" + (null == serverGroupId ? global::System.String.Empty : "serverGroupId=" + global::System.Uri.EscapeDataString(serverGroupId.ToString())) + "&" + (string.IsNullOrEmpty(commcellId) ? global::System.String.Empty : "commcellId=" + global::System.Uri.EscapeDataString(commcellId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBlackoutWindows_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Blackout Windows</summary> /// <param name="viaIdentity"></param> /// <param name="showOnlyCommcellLevel">Shows blackout window at commcell level if set to true.</param> /// <param name="companyId">Shows blackout windows associated with the company whose id has been provided.</param> /// <param name="serverGroupId">Shows blackout windows associated with the server group whose id has been provided.</param> /// <param name="commcellId">Shows blackout windows associated with the commcell whose id has been provided.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetBlackoutWindowsViaIdentity(global::System.String viaIdentity, bool? showOnlyCommcellLevel, long? companyId, long? serverGroupId, string commcellId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindowsListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/BlackoutWindow$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/BlackoutWindow'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/BlackoutWindow" + "?" + (null == showOnlyCommcellLevel ? global::System.String.Empty : "showOnlyCommcellLevel=" + global::System.Uri.EscapeDataString(showOnlyCommcellLevel.ToString())) + "&" + (null == companyId ? global::System.String.Empty : "companyId=" + global::System.Uri.EscapeDataString(companyId.ToString())) + "&" + (null == serverGroupId ? global::System.String.Empty : "serverGroupId=" + global::System.Uri.EscapeDataString(serverGroupId.ToString())) + "&" + (string.IsNullOrEmpty(commcellId) ? global::System.String.Empty : "commcellId=" + global::System.Uri.EscapeDataString(commcellId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetBlackoutWindows_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Blackout Windows</summary> /// <param name="viaIdentity"></param> /// <param name="showOnlyCommcellLevel">Shows blackout window at commcell level if set to true.</param> /// <param name="companyId">Shows blackout windows associated with the company whose id has been provided.</param> /// <param name="serverGroupId">Shows blackout windows associated with the server group whose id has been provided.</param> /// <param name="commcellId">Shows blackout windows associated with the commcell whose id has been provided.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindowsListResponse>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindowsListResponse> GetBlackoutWindowsViaIdentityWithResult(global::System.String viaIdentity, bool? showOnlyCommcellLevel, long? companyId, long? serverGroupId, string commcellId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/BlackoutWindow$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/BlackoutWindow'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/BlackoutWindow" + "?" + (null == showOnlyCommcellLevel ? global::System.String.Empty : "showOnlyCommcellLevel=" + global::System.Uri.EscapeDataString(showOnlyCommcellLevel.ToString())) + "&" + (null == companyId ? global::System.String.Empty : "companyId=" + global::System.Uri.EscapeDataString(companyId.ToString())) + "&" + (null == serverGroupId ? global::System.String.Empty : "serverGroupId=" + global::System.Uri.EscapeDataString(serverGroupId.ToString())) + "&" + (string.IsNullOrEmpty(commcellId) ? global::System.String.Empty : "commcellId=" + global::System.Uri.EscapeDataString(commcellId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetBlackoutWindowsWithResult_Call (request, eventListener,sender); } } /// <summary>Get All Blackout Windows</summary> /// <param name="showOnlyCommcellLevel">Shows blackout window at commcell level if set to true.</param> /// <param name="companyId">Shows blackout windows associated with the company whose id has been provided.</param> /// <param name="serverGroupId">Shows blackout windows associated with the server group whose id has been provided.</param> /// <param name="commcellId">Shows blackout windows associated with the commcell whose id has been provided.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindowsListResponse>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindowsListResponse> GetBlackoutWindowsWithResult(bool? showOnlyCommcellLevel, long? companyId, long? serverGroupId, string commcellId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/BlackoutWindow" + "?" + (null == showOnlyCommcellLevel ? global::System.String.Empty : "showOnlyCommcellLevel=" + global::System.Uri.EscapeDataString(showOnlyCommcellLevel.ToString())) + "&" + (null == companyId ? global::System.String.Empty : "companyId=" + global::System.Uri.EscapeDataString(companyId.ToString())) + "&" + (null == serverGroupId ? global::System.String.Empty : "serverGroupId=" + global::System.Uri.EscapeDataString(serverGroupId.ToString())) + "&" + (string.IsNullOrEmpty(commcellId) ? global::System.String.Empty : "commcellId=" + global::System.Uri.EscapeDataString(commcellId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetBlackoutWindowsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetBlackoutWindowsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindowsListResponse>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindowsListResponse> GetBlackoutWindowsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.BlackoutWindowsListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetBlackoutWindows" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBlackoutWindows_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBlackoutWindowsListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.BlackoutWindowsListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetBlackoutWindows" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="showOnlyCommcellLevel">Shows blackout window at commcell level if set to true.</param> /// <param name="companyId">Shows blackout windows associated with the company whose id has been provided.</param> /// <param name="serverGroupId">Shows blackout windows associated with the server group whose id has been provided.</param> /// <param name="commcellId">Shows blackout windows associated with the commcell whose id has been provided.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetBlackoutWindows_Validate(bool? showOnlyCommcellLevel, long? companyId, long? serverGroupId, string commcellId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(commcellId),commcellId); } } /// <summary>API to get client information that retire operation concerns</summary> /// <param name="clientId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetClientInfoForRetire(long clientId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IClientInfoForRetire>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Client/" + (clientId.ToString()) + "/RetireInformation" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetClientInfoForRetire_Call (request, onOk,eventListener,sender); } } /// <summary>API to get client information that retire operation concerns</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetClientInfoForRetireViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IClientInfoForRetire>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Client/(?<clientId>[^/]+)/RetireInformation$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Client/{clientId}/RetireInformation'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Client/" + clientId + "/RetireInformation" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetClientInfoForRetire_Call (request, onOk,eventListener,sender); } } /// <summary>API to get client information that retire operation concerns</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IClientInfoForRetire>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IClientInfoForRetire> GetClientInfoForRetireViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Client/(?<clientId>[^/]+)/RetireInformation$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Client/{clientId}/RetireInformation'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Client/" + clientId + "/RetireInformation" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetClientInfoForRetireWithResult_Call (request, eventListener,sender); } } /// <summary>API to get client information that retire operation concerns</summary> /// <param name="clientId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IClientInfoForRetire>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IClientInfoForRetire> GetClientInfoForRetireWithResult(long clientId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Client/" + (clientId.ToString()) + "/RetireInformation" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetClientInfoForRetireWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetClientInfoForRetireWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IClientInfoForRetire>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IClientInfoForRetire> GetClientInfoForRetireWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ClientInfoForRetire.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetClientInfoForRetire" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetClientInfoForRetire_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IClientInfoForRetire>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ClientInfoForRetire.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetClientInfoForRetire" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="clientId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetClientInfoForRetire_Validate(long clientId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get all arrays at client level</summary> /// <param name="clientId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetClientLvlArrays(long clientId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Client/" + (clientId.ToString()) + "/Arrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetClientLvlArrays_Call (request, onOk,eventListener,sender); } } /// <summary>API to get all arrays at client level</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetClientLvlArraysViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Client/(?<clientId>[^/]+)/Arrays$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Client/{clientId}/Arrays'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Client/" + clientId + "/Arrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetClientLvlArrays_Call (request, onOk,eventListener,sender); } } /// <summary>API to get all arrays at client level</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp> GetClientLvlArraysViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Client/(?<clientId>[^/]+)/Arrays$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Client/{clientId}/Arrays'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Client/" + clientId + "/Arrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetClientLvlArraysWithResult_Call (request, eventListener,sender); } } /// <summary>API to get all arrays at client level</summary> /// <param name="clientId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp> GetClientLvlArraysWithResult(long clientId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Client/" + (clientId.ToString()) + "/Arrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetClientLvlArraysWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetClientLvlArraysWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp> GetClientLvlArraysWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetArraysResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetClientLvlArrays" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetClientLvlArrays_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetArraysResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetClientLvlArrays" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="clientId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetClientLvlArrays_Validate(long clientId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to fetch Snap configs for Storage Arrays at client level</summary> /// <param name="arrayId"></param> /// <param name="clientId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetClientSnapConfigs(long arrayId, long clientId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Client/" + (clientId.ToString()) + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetClientSnapConfigs_Call (request, onOk,eventListener,sender); } } /// <summary>API to fetch Snap configs for Storage Arrays at client level</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetClientSnapConfigsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Client/(?<clientId>[^/]+)/Snap/Configs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Client/{clientId}/Snap/Configs'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Client/" + clientId + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetClientSnapConfigs_Call (request, onOk,eventListener,sender); } } /// <summary>API to fetch Snap configs for Storage Arrays at client level</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp> GetClientSnapConfigsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Client/(?<clientId>[^/]+)/Snap/Configs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Client/{clientId}/Snap/Configs'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Client/" + clientId + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetClientSnapConfigsWithResult_Call (request, eventListener,sender); } } /// <summary>API to fetch Snap configs for Storage Arrays at client level</summary> /// <param name="arrayId"></param> /// <param name="clientId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp> GetClientSnapConfigsWithResult(long arrayId, long clientId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Client/" + (clientId.ToString()) + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetClientSnapConfigsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetClientSnapConfigsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp> GetClientSnapConfigsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapConfigOverrideResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetClientSnapConfigs" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetClientSnapConfigs_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapConfigOverrideResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetClientSnapConfigs" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="arrayId"></param> /// <param name="clientId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetClientSnapConfigs_Validate(long arrayId, long clientId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the list of clients associated with the BackupDestination.</summary> /// <param name="backupDestinationId">Id of the BackupDestination.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetClientsForBackupDestination(long backupDestinationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IClientListForStorageResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + (backupDestinationId.ToString()) + "/Clients" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetClientsForBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get the list of clients associated with the BackupDestination.</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetClientsForBackupDestinationViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IClientListForStorageResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/BackupDestination/(?<backupDestinationId>[^/]+)/Clients$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/BackupDestination/{backupDestinationId}/Clients'"); } // replace URI parameters with values from identity var backupDestinationId = _match.Groups["backupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + backupDestinationId + "/Clients" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetClientsForBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetClientsForBackupDestination" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetClientsForBackupDestination_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IClientListForStorageResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ClientListForStorageResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetClientsForBackupDestination" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="backupDestinationId">Id of the BackupDestination.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetClientsForBackupDestination_Validate(long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get Cloud Storage Details</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="showInheritedAssociation">Set to true if want to show inherited security associations</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCloudStorageById(long cloudStorageId, string showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsXt7ZxhV4StorageCloudCloudstorageidGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "?" + (string.IsNullOrEmpty(showInheritedAssociation) ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCloudStorageById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Get Cloud Storage Details</summary> /// <param name="viaIdentity"></param> /// <param name="showInheritedAssociation">Set to true if want to show inherited security associations</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCloudStorageByIdViaIdentity(global::System.String viaIdentity, string showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsXt7ZxhV4StorageCloudCloudstorageidGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "?" + (string.IsNullOrEmpty(showInheritedAssociation) ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCloudStorageById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetCloudStorageById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCloudStorageById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsXt7ZxhV4StorageCloudCloudstorageidGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PathsXt7ZxhV4StorageCloudCloudstorageidGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetCloudStorageById" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="showInheritedAssociation">Set to true if want to show inherited security associations</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCloudStorageById_Validate(long cloudStorageId, string showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(showInheritedAssociation),showInheritedAssociation); } } /// <summary>Get All Cloud Storage</summary> /// <param name="storageSubType">Filter cloud storage list to given subtype.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCloudStorageList(string storageSubType, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths14GiyiiV4StorageCloudGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud" + "?" + (string.IsNullOrEmpty(storageSubType) ? global::System.String.Empty : "storageSubType=" + global::System.Uri.EscapeDataString(storageSubType)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCloudStorageList_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Cloud Storage</summary> /// <param name="viaIdentity"></param> /// <param name="storageSubType">Filter cloud storage list to given subtype.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCloudStorageListViaIdentity(global::System.String viaIdentity, string storageSubType, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths14GiyiiV4StorageCloudGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud" + "?" + (string.IsNullOrEmpty(storageSubType) ? global::System.String.Empty : "storageSubType=" + global::System.Uri.EscapeDataString(storageSubType)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCloudStorageList_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetCloudStorageList" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCloudStorageList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths14GiyiiV4StorageCloudGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths14GiyiiV4StorageCloudGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetCloudStorageList" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storageSubType">Filter cloud storage list to given subtype.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCloudStorageList_Validate(string storageSubType, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(storageSubType),storageSubType); } } /// <summary>Get details of metadata Cache of a cloud storage based on Id</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="metadataCacheId">Id of metadata cache</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCloudStorageMetaDataCacheById(long cloudStorageId, long metadataCacheId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMetadataCacheConfiguration>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/MetadataCache/" + (metadataCacheId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCloudStorageMetaDataCacheById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Get details of metadata Cache of a cloud storage based on Id</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCloudStorageMetaDataCacheByIdViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMetadataCacheConfiguration>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/MetadataCache/(?<metadataCacheId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/MetadataCache/{metadataCacheId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var metadataCacheId = _match.Groups["metadataCacheId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/MetadataCache/" + metadataCacheId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCloudStorageMetaDataCacheById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetCloudStorageMetaDataCacheById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCloudStorageMetaDataCacheById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMetadataCacheConfiguration>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MetadataCacheConfiguration.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetCloudStorageMetaDataCacheById" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="metadataCacheId">Id of metadata cache</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCloudStorageMetaDataCacheById_Validate(long cloudStorageId, long metadataCacheId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get All Companies</summary> /// <param name="includeDeletedCompanies">If true, companies marked for deletion are included in the response</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCompanies(bool? includeDeletedCompanies, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompanyListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company" + "?" + (null == includeDeletedCompanies ? global::System.String.Empty : "includeDeletedCompanies=" + global::System.Uri.EscapeDataString(includeDeletedCompanies.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCompanies_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Companies</summary> /// <param name="viaIdentity"></param> /// <param name="includeDeletedCompanies">If true, companies marked for deletion are included in the response</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCompaniesViaIdentity(global::System.String viaIdentity, bool? includeDeletedCompanies, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompanyListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/company$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/company'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company" + "?" + (null == includeDeletedCompanies ? global::System.String.Empty : "includeDeletedCompanies=" + global::System.Uri.EscapeDataString(includeDeletedCompanies.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCompanies_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Companies</summary> /// <param name="viaIdentity"></param> /// <param name="includeDeletedCompanies">If true, companies marked for deletion are included in the response</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompanyListResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompanyListResponse> GetCompaniesViaIdentityWithResult(global::System.String viaIdentity, bool? includeDeletedCompanies, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/company$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/company'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company" + "?" + (null == includeDeletedCompanies ? global::System.String.Empty : "includeDeletedCompanies=" + global::System.Uri.EscapeDataString(includeDeletedCompanies.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetCompaniesWithResult_Call (request, eventListener,sender); } } /// <summary>Get All Companies</summary> /// <param name="includeDeletedCompanies">If true, companies marked for deletion are included in the response</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompanyListResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompanyListResponse> GetCompaniesWithResult(bool? includeDeletedCompanies, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company" + "?" + (null == includeDeletedCompanies ? global::System.String.Empty : "includeDeletedCompanies=" + global::System.Uri.EscapeDataString(includeDeletedCompanies.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetCompaniesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetCompaniesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompanyListResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompanyListResponse> GetCompaniesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CompanyListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetCompanies" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCompanies_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompanyListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CompanyListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetCompanies" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="includeDeletedCompanies">If true, companies marked for deletion are included in the response</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCompanies_Validate(bool? includeDeletedCompanies, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details of a company based on id</summary> /// <param name="companyId">Id of the Company whose details have to be fetched</param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCompanyDetails(long companyId, bool? showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompany>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company/" + (companyId.ToString()) + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCompanyDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a company based on id</summary> /// <param name="viaIdentity"></param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCompanyDetailsViaIdentity(global::System.String viaIdentity, bool? showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompany>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/company/(?<companyId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/company/{companyId}'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company/" + companyId + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCompanyDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a company based on id</summary> /// <param name="viaIdentity"></param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompany>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompany> GetCompanyDetailsViaIdentityWithResult(global::System.String viaIdentity, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/company/(?<companyId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/company/{companyId}'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company/" + companyId + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetCompanyDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get details of a company based on id</summary> /// <param name="companyId">Id of the Company whose details have to be fetched</param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompany>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompany> GetCompanyDetailsWithResult(long companyId, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company/" + (companyId.ToString()) + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetCompanyDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetCompanyDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompany>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompany> GetCompanyDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Company.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetCompanyDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCompanyDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICompany>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Company.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetCompanyDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="companyId">Id of the Company whose details have to be fetched</param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCompanyDetails_Validate(long companyId, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get a company's laptop admins.</summary> /// <param name="companyId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCompanyLaptopAdmins(long companyId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetLaptopAdminsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/LaptopAdmins" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCompanyLaptopAdmins_Call (request, onOk,eventListener,sender); } } /// <summary>Get a company's laptop admins.</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCompanyLaptopAdminsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetLaptopAdminsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/LaptopAdmins$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/LaptopAdmins'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/LaptopAdmins" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCompanyLaptopAdmins_Call (request, onOk,eventListener,sender); } } /// <summary>Get a company's laptop admins.</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetLaptopAdminsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetLaptopAdminsResp> GetCompanyLaptopAdminsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/LaptopAdmins$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/LaptopAdmins'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/LaptopAdmins" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetCompanyLaptopAdminsWithResult_Call (request, eventListener,sender); } } /// <summary>Get a company's laptop admins.</summary> /// <param name="companyId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetLaptopAdminsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetLaptopAdminsResp> GetCompanyLaptopAdminsWithResult(long companyId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/LaptopAdmins" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetCompanyLaptopAdminsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetCompanyLaptopAdminsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetLaptopAdminsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetLaptopAdminsResp> GetCompanyLaptopAdminsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetLaptopAdminsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetCompanyLaptopAdmins" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCompanyLaptopAdmins_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetLaptopAdminsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetLaptopAdminsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetCompanyLaptopAdmins" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="companyId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCompanyLaptopAdmins_Validate(long companyId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>To get a list of all the agents configured for a user</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetConfiguredAgents(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAllApplicableAgentResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CommCell/Agents" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetConfiguredAgents_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>To get a list of all the agents configured for a user</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAllApplicableAgentResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAllApplicableAgentResp> GetConfiguredAgentsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CommCell/Agents" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetConfiguredAgentsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetConfiguredAgentsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAllApplicableAgentResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAllApplicableAgentResp> GetConfiguredAgentsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetAllApplicableAgentResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetConfiguredAgents" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetConfiguredAgents_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetAllApplicableAgentResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetAllApplicableAgentResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetConfiguredAgents" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetConfiguredAgents_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to fetch snap configs for storage arrays at copy level</summary> /// <param name="copyId"></param> /// <param name="arrayId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCopyConfigs(long copyId, long arrayId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Copy/" + (copyId.ToString()) + "/Arrays/" + (arrayId.ToString()) + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCopyConfigs_Call (request, onOk,eventListener,sender); } } /// <summary>API to fetch snap configs for storage arrays at copy level</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCopyConfigsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Copy/(?<copyId>[^/]+)/Arrays/(?<arrayId>[^/]+)/Snap/Configs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Copy/{copyId}/Arrays/{arrayId}/Snap/Configs'"); } // replace URI parameters with values from identity var copyId = _match.Groups["copyId"].Value; var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Copy/" + copyId + "/Arrays/" + arrayId + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCopyConfigs_Call (request, onOk,eventListener,sender); } } /// <summary>API to fetch snap configs for storage arrays at copy level</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp> GetCopyConfigsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Copy/(?<copyId>[^/]+)/Arrays/(?<arrayId>[^/]+)/Snap/Configs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Copy/{copyId}/Arrays/{arrayId}/Snap/Configs'"); } // replace URI parameters with values from identity var copyId = _match.Groups["copyId"].Value; var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Copy/" + copyId + "/Arrays/" + arrayId + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetCopyConfigsWithResult_Call (request, eventListener,sender); } } /// <summary>API to fetch snap configs for storage arrays at copy level</summary> /// <param name="copyId"></param> /// <param name="arrayId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp> GetCopyConfigsWithResult(long copyId, long arrayId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Copy/" + (copyId.ToString()) + "/Arrays/" + (arrayId.ToString()) + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetCopyConfigsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetCopyConfigsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp> GetCopyConfigsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapConfigOverrideResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetCopyConfigs" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCopyConfigs_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapConfigOverrideResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetCopyConfigs" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="copyId"></param> /// <param name="arrayId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCopyConfigs_Validate(long copyId, long arrayId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get arrays list at copy level</summary> /// <param name="copyId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCopytLvlArrays(long copyId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Copy/" + (copyId.ToString()) + "/Arrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCopytLvlArrays_Call (request, onOk,eventListener,sender); } } /// <summary>API to get arrays list at copy level</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCopytLvlArraysViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Copy/(?<copyId>[^/]+)/Arrays$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Copy/{copyId}/Arrays'"); } // replace URI parameters with values from identity var copyId = _match.Groups["copyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Copy/" + copyId + "/Arrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCopytLvlArrays_Call (request, onOk,eventListener,sender); } } /// <summary>API to get arrays list at copy level</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp> GetCopytLvlArraysViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Copy/(?<copyId>[^/]+)/Arrays$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Copy/{copyId}/Arrays'"); } // replace URI parameters with values from identity var copyId = _match.Groups["copyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Copy/" + copyId + "/Arrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetCopytLvlArraysWithResult_Call (request, eventListener,sender); } } /// <summary>API to get arrays list at copy level</summary> /// <param name="copyId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp> GetCopytLvlArraysWithResult(long copyId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Copy/" + (copyId.ToString()) + "/Arrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetCopytLvlArraysWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetCopytLvlArraysWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp> GetCopytLvlArraysWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetArraysResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetCopytLvlArrays" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCopytLvlArrays_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetArraysResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetCopytLvlArrays" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="copyId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCopytLvlArrays_Validate(long copyId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// This endpoint is used to return the list of cloud accounts for Cloud Resource Discovery operation. /// </summary> /// <param name="vendor">Type of the cloud vendor. Cloud accounts for the specified cloud vendor will be returned. /// Supported Vendor type: /// 3-Azure /// </param> /// <param name="targetApp">App type for which the Cloud Resorce Discovery instance is being configured. /// Supported App type: /// 134-Cloud Apps /// </param> /// <param name="targetInstance">Cloud apps instance type for which the Cloud Resorce Discovery instance is being configured. /// Supported Cloud apps instance type: /// 6-Azure Blob /// </param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCrdCloudAccounts(long vendor, long? targetApp, long? targetInstance, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCrdCloudAccountsResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CRD/CloudAccounts" + "?" + "vendor=" + global::System.Uri.EscapeDataString(vendor.ToString()) + "&" + (null == targetApp ? global::System.String.Empty : "targetApp=" + global::System.Uri.EscapeDataString(targetApp.ToString())) + "&" + (null == targetInstance ? global::System.String.Empty : "targetInstance=" + global::System.Uri.EscapeDataString(targetInstance.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCrdCloudAccounts_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary> /// This endpoint is used to return the list of cloud accounts for Cloud Resource Discovery operation. /// </summary> /// <param name="viaIdentity"></param> /// <param name="vendor">Type of the cloud vendor. Cloud accounts for the specified cloud vendor will be returned. /// Supported Vendor type: /// 3-Azure /// </param> /// <param name="targetApp">App type for which the Cloud Resorce Discovery instance is being configured. /// Supported App type: /// 134-Cloud Apps /// </param> /// <param name="targetInstance">Cloud apps instance type for which the Cloud Resorce Discovery instance is being configured. /// Supported Cloud apps instance type: /// 6-Azure Blob /// </param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCrdCloudAccountsViaIdentity(global::System.String viaIdentity, long vendor, long? targetApp, long? targetInstance, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCrdCloudAccountsResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CRD/CloudAccounts$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CRD/CloudAccounts'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CRD/CloudAccounts" + "?" + "vendor=" + global::System.Uri.EscapeDataString(vendor.ToString()) + "&" + (null == targetApp ? global::System.String.Empty : "targetApp=" + global::System.Uri.EscapeDataString(targetApp.ToString())) + "&" + (null == targetInstance ? global::System.String.Empty : "targetInstance=" + global::System.Uri.EscapeDataString(targetInstance.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCrdCloudAccounts_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary> /// This endpoint is used to return the list of cloud accounts for Cloud Resource Discovery operation. /// </summary> /// <param name="viaIdentity"></param> /// <param name="vendor">Type of the cloud vendor. Cloud accounts for the specified cloud vendor will be returned. /// Supported Vendor type: /// 3-Azure /// </param> /// <param name="targetApp">App type for which the Cloud Resorce Discovery instance is being configured. /// Supported App type: /// 134-Cloud Apps /// </param> /// <param name="targetInstance">Cloud apps instance type for which the Cloud Resorce Discovery instance is being configured. /// Supported Cloud apps instance type: /// 6-Azure Blob /// </param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCrdCloudAccountsResponse>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCrdCloudAccountsResponse> GetCrdCloudAccountsViaIdentityWithResult(global::System.String viaIdentity, long vendor, long? targetApp, long? targetInstance, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CRD/CloudAccounts$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CRD/CloudAccounts'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CRD/CloudAccounts" + "?" + "vendor=" + global::System.Uri.EscapeDataString(vendor.ToString()) + "&" + (null == targetApp ? global::System.String.Empty : "targetApp=" + global::System.Uri.EscapeDataString(targetApp.ToString())) + "&" + (null == targetInstance ? global::System.String.Empty : "targetInstance=" + global::System.Uri.EscapeDataString(targetInstance.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetCrdCloudAccountsWithResult_Call (request, eventListener,sender); } } /// <summary> /// This endpoint is used to return the list of cloud accounts for Cloud Resource Discovery operation. /// </summary> /// <param name="vendor">Type of the cloud vendor. Cloud accounts for the specified cloud vendor will be returned. /// Supported Vendor type: /// 3-Azure /// </param> /// <param name="targetApp">App type for which the Cloud Resorce Discovery instance is being configured. /// Supported App type: /// 134-Cloud Apps /// </param> /// <param name="targetInstance">Cloud apps instance type for which the Cloud Resorce Discovery instance is being configured. /// Supported Cloud apps instance type: /// 6-Azure Blob /// </param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCrdCloudAccountsResponse>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCrdCloudAccountsResponse> GetCrdCloudAccountsWithResult(long vendor, long? targetApp, long? targetInstance, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CRD/CloudAccounts" + "?" + "vendor=" + global::System.Uri.EscapeDataString(vendor.ToString()) + "&" + (null == targetApp ? global::System.String.Empty : "targetApp=" + global::System.Uri.EscapeDataString(targetApp.ToString())) + "&" + (null == targetInstance ? global::System.String.Empty : "targetInstance=" + global::System.Uri.EscapeDataString(targetInstance.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetCrdCloudAccountsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetCrdCloudAccountsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCrdCloudAccountsResponse>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCrdCloudAccountsResponse> GetCrdCloudAccountsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetCrdCloudAccountsResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetCrdCloudAccounts" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCrdCloudAccounts_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCrdCloudAccountsResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetCrdCloudAccountsResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetCrdCloudAccounts" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="vendor">Type of the cloud vendor. Cloud accounts for the specified cloud vendor will be returned. /// Supported Vendor type: /// 3-Azure /// </param> /// <param name="targetApp">App type for which the Cloud Resorce Discovery instance is being configured. /// Supported App type: /// 134-Cloud Apps /// </param> /// <param name="targetInstance">Cloud apps instance type for which the Cloud Resorce Discovery instance is being configured. /// Supported Cloud apps instance type: /// 6-Azure Blob /// </param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCrdCloudAccounts_Validate(long vendor, long? targetApp, long? targetInstance, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>List of Credentials</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCredentials(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICredentialManagerListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Credential" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCredentials_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>List of Credentials</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICredentialManagerListResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICredentialManagerListResp> GetCredentialsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Credential" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetCredentialsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetCredentialsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICredentialManagerListResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICredentialManagerListResp> GetCredentialsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CredentialManagerListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetCredentials" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCredentials_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICredentialManagerListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CredentialManagerListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetCredentials" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCredentials_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Fetches the details of the given CVFS bucket</summary> /// <param name="id">ID of the bucket</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCvfsS3Bucket(long id, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCvfss3BucketResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + (id.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCvfsS3Bucket_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Fetches the details of the given CVFS bucket</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCvfsS3BucketViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCvfss3BucketResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CVFS/S3Bucket/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CVFS/S3Bucket/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + id ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCvfsS3Bucket_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetCvfsS3Bucket" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCvfsS3Bucket_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCvfss3BucketResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetCvfss3BucketResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetCvfsS3Bucket" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id">ID of the bucket</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCvfsS3Bucket_Validate(long id, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Retrieve the list of credentials for Cyber Resilience</summary> /// <param name="retrieveConfiguredOnly">If set to true, retrieve only the credentials that are configured</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCyberResilienceCredentials(bool? retrieveConfiguredOnly, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceCredentials>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CyberResilience/Credentials" + "?" + (null == retrieveConfiguredOnly ? global::System.String.Empty : "retrieveConfiguredOnly=" + global::System.Uri.EscapeDataString(retrieveConfiguredOnly.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCyberResilienceCredentials_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Retrieve the list of credentials for Cyber Resilience</summary> /// <param name="viaIdentity"></param> /// <param name="retrieveConfiguredOnly">If set to true, retrieve only the credentials that are configured</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCyberResilienceCredentialsViaIdentity(global::System.String viaIdentity, bool? retrieveConfiguredOnly, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceCredentials>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CyberResilience/Credentials$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CyberResilience/Credentials'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CyberResilience/Credentials" + "?" + (null == retrieveConfiguredOnly ? global::System.String.Empty : "retrieveConfiguredOnly=" + global::System.Uri.EscapeDataString(retrieveConfiguredOnly.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCyberResilienceCredentials_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetCyberResilienceCredentials" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCyberResilienceCredentials_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceCredentials>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceCredentials.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetCyberResilienceCredentials" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="retrieveConfiguredOnly">If set to true, retrieve only the credentials that are configured</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCyberResilienceCredentials_Validate(bool? retrieveConfiguredOnly, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Retrieve the sync status for configured credentials</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetCyberResilienceSyncStatus(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceSyncStatus>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CyberResilience/Credentials/Sync/Status" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetCyberResilienceSyncStatus_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetCyberResilienceSyncStatus" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCyberResilienceSyncStatus_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceSyncStatus>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceSyncStatus.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetCyberResilienceSyncStatus" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetCyberResilienceSyncStatus_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get all databases</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetDatabases(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDatabaseListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Databases" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetDatabases_Call (request, onOk,eventListener,sender); } } /// <summary>Get all databases</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDatabaseListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDatabaseListResp> GetDatabasesWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Databases" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetDatabasesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetDatabasesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDatabaseListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDatabaseListResp> GetDatabasesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.DatabaseListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetDatabases" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDatabases_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDatabaseListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.DatabaseListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetDatabases" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDatabases_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get Data Classification Plan details</summary> /// <param name="planId">Id of the plan to fetch details</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetDcPlanById(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDcPlanDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DCPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetDcPlanById_Call (request, onOk,onBadRequest,onForbidden,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Get Data Classification Plan details</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetDcPlanByIdViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDcPlanDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/DCPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/DCPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DCPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetDcPlanById_Call (request, onOk,onBadRequest,onForbidden,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetDcPlanById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDcPlanById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDcPlanDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.DcPlanDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetDcPlanById" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the plan to fetch details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDcPlanById_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Fetch the default inventory associated to the index server</summary> /// <param name="indexServerClientId">Pseudo client id of the index server</param> /// <param name="createIfAbsent">Create the default inventory if it is missing for the index server</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetDefaultInventory(long indexServerClientId, bool? createIfAbsent, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/" + (indexServerClientId.ToString()) + "/Default" + "?" + (null == createIfAbsent ? global::System.String.Empty : "createIfAbsent=" + global::System.Uri.EscapeDataString(createIfAbsent.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetDefaultInventory_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Fetch the default inventory associated to the index server</summary> /// <param name="viaIdentity"></param> /// <param name="createIfAbsent">Create the default inventory if it is missing for the index server</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetDefaultInventoryViaIdentity(global::System.String viaIdentity, bool? createIfAbsent, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/InventoryManager/(?<indexServerClientId>[^/]+)/Default$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/InventoryManager/{indexServerClientId}/Default'"); } // replace URI parameters with values from identity var indexServerClientId = _match.Groups["indexServerClientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/" + indexServerClientId + "/Default" + "?" + (null == createIfAbsent ? global::System.String.Empty : "createIfAbsent=" + global::System.Uri.EscapeDataString(createIfAbsent.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetDefaultInventory_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetDefaultInventory" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDefaultInventory_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.InventoryDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetDefaultInventory" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="indexServerClientId">Pseudo client id of the index server</param> /// <param name="createIfAbsent">Create the default inventory if it is missing for the index server</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDefaultInventory_Validate(long indexServerClientId, bool? createIfAbsent, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details of a disk storage pool based on id</summary> /// <param name="storagePoolId">Id of the disk storage pool whose details have to be fetched</param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetDiskStorageDetails(long storagePoolId, bool? showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDiskStorage>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetDiskStorageDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Get details of a disk storage pool based on id</summary> /// <param name="viaIdentity"></param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetDiskStorageDetailsViaIdentity(global::System.String viaIdentity, bool? showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDiskStorage>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetDiskStorageDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Get details of a disk storage pool based on id</summary> /// <param name="viaIdentity"></param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDiskStorage>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDiskStorage> GetDiskStorageDetailsViaIdentityWithResult(global::System.String viaIdentity, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetDiskStorageDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get details of a disk storage pool based on id</summary> /// <param name="storagePoolId">Id of the disk storage pool whose details have to be fetched</param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDiskStorage>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDiskStorage> GetDiskStorageDetailsWithResult(long storagePoolId, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetDiskStorageDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetDiskStorageDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDiskStorage>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDiskStorage> GetDiskStorageDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.DiskStorage.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetDiskStorageDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDiskStorageDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDiskStorage>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.DiskStorage.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetDiskStorageDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the disk storage pool whose details have to be fetched</param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDiskStorageDetails_Validate(long storagePoolId, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get a list of disk storage pools</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetDiskStorages(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetDiskStorages_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get a list of disk storage pools</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageListResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageListResponse> GetDiskStoragesWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetDiskStoragesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetDiskStoragesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageListResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageListResponse> GetDiskStoragesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.StorageListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetDiskStorages" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDiskStorages_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.StorageListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetDiskStorages" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDiskStorages_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the list of distributed storages</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetDistributedStorages(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDistributedStorageListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/DistributedStorage" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetDistributedStorages_Call (request, onOk,eventListener,sender); } } /// <summary>Get the list of distributed storages</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDistributedStorageListResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDistributedStorageListResp> GetDistributedStoragesWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/DistributedStorage" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetDistributedStoragesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetDistributedStoragesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDistributedStorageListResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDistributedStorageListResp> GetDistributedStoragesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.DistributedStorageListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetDistributedStorages" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDistributedStorages_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDistributedStorageListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.DistributedStorageListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetDistributedStorages" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDistributedStorages_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>This endpoint is used to return the list of distributed systems.</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetDistributedSystems(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDistributedSystemsListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DistributedSystems" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetDistributedSystems_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>This endpoint is used to return the list of distributed systems.</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDistributedSystemsListResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDistributedSystemsListResp> GetDistributedSystemsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DistributedSystems" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetDistributedSystemsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetDistributedSystemsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDistributedSystemsListResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDistributedSystemsListResp> GetDistributedSystemsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.DistributedSystemsListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetDistributedSystems" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDistributedSystems_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDistributedSystemsListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.DistributedSystemsListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetDistributedSystems" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDistributedSystems_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get specific backup destination details for Commserve DR Backups</summary> /// <param name="backupDestinationId">Id of the backup destination</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetDrBackupDestinationDetails(long backupDestinationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DRBackup/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetDrBackupDestinationDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Get specific backup destination details for Commserve DR Backups</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetDrBackupDestinationDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/DRBackup/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/DRBackup/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DRBackup/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetDrBackupDestinationDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetDrBackupDestinationDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDrBackupDestinationDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetDrBackupDestinationDetails" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="backupDestinationId">Id of the backup destination</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDrBackupDestinationDetails_Validate(long backupDestinationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get backup destinations for CommServe DR Backups</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetDrBackupDestinations(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DRBackup/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetDrBackupDestinations_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetDrBackupDestinations" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDrBackupDestinations_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinations.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetDrBackupDestinations" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDrBackupDestinations_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get DR backup storage policy details</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetDrBackupStoragePolicy(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DRBackup/StoragePolicy" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetDrBackupStoragePolicy_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetDrBackupStoragePolicy" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDrBackupStoragePolicy_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetDrBackupStoragePolicy" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetDrBackupStoragePolicy_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get list of machines eligible to be added to failover group</summary> /// <param name="sourceEntityId">The ID of the source entity. This is the ID for client or client group</param> /// <param name="failoverGroupSource">The type of failover group source. Default value is 'REPLICATION'</param> /// <param name="sourceEntityType">The type of source entity. It can be 'CLIENT' or 'CLIENT_ENTITY'. Default value is 'CLIENT'</param> /// <param name="destinationClientId">The client ID of the destination</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetEligibleMachinesFailoverGroup(long sourceEntityId, string failoverGroupSource, string sourceEntityType, long? destinationClientId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1L7KnsgV4FailovergroupsEligiblemachinesGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/EligibleMachines" + "?" + "sourceEntityId=" + global::System.Uri.EscapeDataString(sourceEntityId.ToString()) + "&" + (string.IsNullOrEmpty(failoverGroupSource) ? global::System.String.Empty : "failoverGroupSource=" + global::System.Uri.EscapeDataString(failoverGroupSource)) + "&" + (string.IsNullOrEmpty(sourceEntityType) ? global::System.String.Empty : "sourceEntityType=" + global::System.Uri.EscapeDataString(sourceEntityType)) + "&" + (null == destinationClientId ? global::System.String.Empty : "destinationClientId=" + global::System.Uri.EscapeDataString(destinationClientId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetEligibleMachinesFailoverGroup_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>API to get list of machines eligible to be added to failover group</summary> /// <param name="viaIdentity"></param> /// <param name="sourceEntityId">The ID of the source entity. This is the ID for client or client group</param> /// <param name="failoverGroupSource">The type of failover group source. Default value is 'REPLICATION'</param> /// <param name="sourceEntityType">The type of source entity. It can be 'CLIENT' or 'CLIENT_ENTITY'. Default value is 'CLIENT'</param> /// <param name="destinationClientId">The client ID of the destination</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetEligibleMachinesFailoverGroupViaIdentity(global::System.String viaIdentity, long sourceEntityId, string failoverGroupSource, string sourceEntityType, long? destinationClientId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1L7KnsgV4FailovergroupsEligiblemachinesGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/FailoverGroups/EligibleMachines$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/FailoverGroups/EligibleMachines'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/EligibleMachines" + "?" + "sourceEntityId=" + global::System.Uri.EscapeDataString(sourceEntityId.ToString()) + "&" + (string.IsNullOrEmpty(failoverGroupSource) ? global::System.String.Empty : "failoverGroupSource=" + global::System.Uri.EscapeDataString(failoverGroupSource)) + "&" + (string.IsNullOrEmpty(sourceEntityType) ? global::System.String.Empty : "sourceEntityType=" + global::System.Uri.EscapeDataString(sourceEntityType)) + "&" + (null == destinationClientId ? global::System.String.Empty : "destinationClientId=" + global::System.Uri.EscapeDataString(destinationClientId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetEligibleMachinesFailoverGroup_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetEligibleMachinesFailoverGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetEligibleMachinesFailoverGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1L7KnsgV4FailovergroupsEligiblemachinesGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths1L7KnsgV4FailovergroupsEligiblemachinesGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetEligibleMachinesFailoverGroup" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="sourceEntityId">The ID of the source entity. This is the ID for client or client group</param> /// <param name="failoverGroupSource">The type of failover group source. Default value is 'REPLICATION'</param> /// <param name="sourceEntityType">The type of source entity. It can be 'CLIENT' or 'CLIENT_ENTITY'. Default value is 'CLIENT'</param> /// <param name="destinationClientId">The client ID of the destination</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetEligibleMachinesFailoverGroup_Validate(long sourceEntityId, string failoverGroupSource, string sourceEntityType, long? destinationClientId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(failoverGroupSource),failoverGroupSource); await eventListener.AssertNotNull(nameof(sourceEntityType),sourceEntityType); } } /// <summary>Retrieves SMTP server details</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetEmailServer(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEmailServerDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onUnauthorized, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EmailServer" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetEmailServer_Call (request, onOk,onUnauthorized,eventListener,sender); } } /// <summary>Retrieves SMTP server details</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEmailServerDetails>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEmailServerDetails> GetEmailServerWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EmailServer" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetEmailServerWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetEmailServerWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEmailServerDetails>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEmailServerDetails> GetEmailServerWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetEmailServerDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetEmailServer" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetEmailServer_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEmailServerDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onUnauthorized, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetEmailServerDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onUnauthorized(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetEmailServer" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetEmailServer_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// Get list of entity settings used to modify default behaviour for linked entity like servers or server groups /// </summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetEntitySettings(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IEntitySettingsResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EntitySettings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetEntitySettings_Call (request, onOk,eventListener,sender); } } /// <summary> /// Get list of entity settings used to modify default behaviour for linked entity like servers or server groups /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IEntitySettingsResponse>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IEntitySettingsResponse> GetEntitySettingsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EntitySettings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetEntitySettingsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetEntitySettingsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IEntitySettingsResponse>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IEntitySettingsResponse> GetEntitySettingsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.EntitySettingsResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetEntitySettings" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetEntitySettings_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IEntitySettingsResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.EntitySettingsResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetEntitySettings" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetEntitySettings_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>This endpoint is used to return the list of epic servers.</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetEpicServers(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EpicServers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetEpicServers_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>This endpoint is used to return the list of epic servers.</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp> GetEpicServersWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EpicServers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetEpicServersWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetEpicServersWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp> GetEpicServersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.FileServerListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetEpicServers" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetEpicServers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.FileServerListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetEpicServers" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetEpicServers_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get list of Office 365 Exchange Online apps</summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetExchangeClient(long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetExchangeClient_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of Office 365 Exchange Online apps</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetExchangeClientViaIdentity(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Exchange$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Exchange'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetExchangeClient_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of Office 365 Exchange Online apps</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp> GetExchangeClientViaIdentityWithResult(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Exchange$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Exchange'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetExchangeClientWithResult_Call (request, eventListener,sender); } } /// <summary>Get list of Office 365 Exchange Online apps</summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp> GetExchangeClientWithResult(long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetExchangeClientWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetExchangeClientWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp> GetExchangeClientWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365ClientsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetExchangeClient" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetExchangeClient_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365ClientsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetExchangeClient" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetExchangeClient_Validate(long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(sort),sort); await eventListener.AssertNotNull(nameof(searchKey),searchKey); } } /// <summary>Get Office 365 Exchange Online Content</summary> /// <param name="appId">Commvault exchange app id</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetExchangeContent(long appId, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ExchangeContentResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange/" + (appId.ToString()) + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetExchangeContent_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Exchange Online Content</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetExchangeContentViaIdentity(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ExchangeContentResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Exchange/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Exchange/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange/" + appId + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetExchangeContent_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Exchange Online Content</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ExchangeContentResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ExchangeContentResp> GetExchangeContentViaIdentityWithResult(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Exchange/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Exchange/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange/" + appId + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetExchangeContentWithResult_Call (request, eventListener,sender); } } /// <summary>Get Office 365 Exchange Online Content</summary> /// <param name="appId">Commvault exchange app id</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ExchangeContentResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ExchangeContentResp> GetExchangeContentWithResult(long appId, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange/" + (appId.ToString()) + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetExchangeContentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetExchangeContentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ExchangeContentResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ExchangeContentResp> GetExchangeContentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365ExchangeContentResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetExchangeContent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetExchangeContent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ExchangeContentResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365ExchangeContentResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetExchangeContent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="appId">Commvault exchange app id</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetExchangeContent_Validate(long appId, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(sort),sort); await eventListener.AssertNotNull(nameof(searchKey),searchKey); } } /// <summary>Get Office 365 Exchange Online Mailboxes</summary> /// <param name="appId">Commvault exchange app id</param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetExchangeMailboxes(long appId, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365MailboxesResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange/" + (appId.ToString()) + "/Mailboxes" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetExchangeMailboxes_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Exchange Online Mailboxes</summary> /// <param name="viaIdentity"></param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetExchangeMailboxesViaIdentity(global::System.String viaIdentity, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365MailboxesResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Exchange/(?<appId>[^/]+)/Mailboxes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Exchange/{appId}/Mailboxes'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange/" + appId + "/Mailboxes" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetExchangeMailboxes_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Exchange Online Mailboxes</summary> /// <param name="viaIdentity"></param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365MailboxesResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365MailboxesResp> GetExchangeMailboxesViaIdentityWithResult(global::System.String viaIdentity, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Exchange/(?<appId>[^/]+)/Mailboxes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Exchange/{appId}/Mailboxes'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange/" + appId + "/Mailboxes" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetExchangeMailboxesWithResult_Call (request, eventListener,sender); } } /// <summary>Get Office 365 Exchange Online Mailboxes</summary> /// <param name="appId">Commvault exchange app id</param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365MailboxesResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365MailboxesResp> GetExchangeMailboxesWithResult(long appId, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Exchange/" + (appId.ToString()) + "/Mailboxes" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetExchangeMailboxesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetExchangeMailboxesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365MailboxesResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365MailboxesResp> GetExchangeMailboxesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365MailboxesResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetExchangeMailboxes" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetExchangeMailboxes_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365MailboxesResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365MailboxesResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetExchangeMailboxes" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="appId">Commvault exchange app id</param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetExchangeMailboxes_Validate(long appId, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(propertyLevel),propertyLevel); await eventListener.AssertNotNull(nameof(sort),sort); await eventListener.AssertNotNull(nameof(searchKey),searchKey); } } /// <summary>API to fetch failover group information</summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetFailoverGroupDetails(long failoverGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFailoverGroupDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + (failoverGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetFailoverGroupDetails_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>API to fetch failover group information</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetFailoverGroupDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFailoverGroupDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/FailoverGroups/(?<failoverGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/FailoverGroups/{failoverGroupId}'"); } // replace URI parameters with values from identity var failoverGroupId = _match.Groups["failoverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + failoverGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetFailoverGroupDetails_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetFailoverGroupDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetFailoverGroupDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFailoverGroupDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.FailoverGroupDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetFailoverGroupDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetFailoverGroupDetails_Validate(long failoverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>This endpoint is used to return the list of file servers.</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetFileServers(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FileServers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetFileServers_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>This endpoint is used to return the list of file servers.</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp> GetFileServersWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FileServers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetFileServersWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetFileServersWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp> GetFileServersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.FileServerListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetFileServers" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetFileServers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFileServerListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.FileServerListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetFileServers" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetFileServers_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get database list for GCP</summary> /// <param name="cloudAccountId">the id of the node where the browse request is sent</param> /// <param name="projectName">google cloud project the instance belongs to</param> /// <param name="instanceName">the google spanner instance name</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetGcpSpannerDatabases(long cloudAccountId, string projectName, string instanceName, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpDatabaseList>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GCPSpanner/databases" + "?" + "cloudAccountId=" + global::System.Uri.EscapeDataString(cloudAccountId.ToString()) + "&" + "projectName=" + global::System.Uri.EscapeDataString(projectName) + "&" + "instanceName=" + global::System.Uri.EscapeDataString(instanceName) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetGcpSpannerDatabases_Call (request, onOk,eventListener,sender); } } /// <summary>Get database list for GCP</summary> /// <param name="viaIdentity"></param> /// <param name="cloudAccountId">the id of the node where the browse request is sent</param> /// <param name="projectName">google cloud project the instance belongs to</param> /// <param name="instanceName">the google spanner instance name</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetGcpSpannerDatabasesViaIdentity(global::System.String viaIdentity, long cloudAccountId, string projectName, string instanceName, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpDatabaseList>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/GCPSpanner/databases$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/GCPSpanner/databases'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GCPSpanner/databases" + "?" + "cloudAccountId=" + global::System.Uri.EscapeDataString(cloudAccountId.ToString()) + "&" + "projectName=" + global::System.Uri.EscapeDataString(projectName) + "&" + "instanceName=" + global::System.Uri.EscapeDataString(instanceName) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetGcpSpannerDatabases_Call (request, onOk,eventListener,sender); } } /// <summary>Get database list for GCP</summary> /// <param name="viaIdentity"></param> /// <param name="cloudAccountId">the id of the node where the browse request is sent</param> /// <param name="projectName">google cloud project the instance belongs to</param> /// <param name="instanceName">the google spanner instance name</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpDatabaseList>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpDatabaseList> GetGcpSpannerDatabasesViaIdentityWithResult(global::System.String viaIdentity, long cloudAccountId, string projectName, string instanceName, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/GCPSpanner/databases$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/GCPSpanner/databases'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GCPSpanner/databases" + "?" + "cloudAccountId=" + global::System.Uri.EscapeDataString(cloudAccountId.ToString()) + "&" + "projectName=" + global::System.Uri.EscapeDataString(projectName) + "&" + "instanceName=" + global::System.Uri.EscapeDataString(instanceName) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetGcpSpannerDatabasesWithResult_Call (request, eventListener,sender); } } /// <summary>Get database list for GCP</summary> /// <param name="cloudAccountId">the id of the node where the browse request is sent</param> /// <param name="projectName">google cloud project the instance belongs to</param> /// <param name="instanceName">the google spanner instance name</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpDatabaseList>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpDatabaseList> GetGcpSpannerDatabasesWithResult(long cloudAccountId, string projectName, string instanceName, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GCPSpanner/databases" + "?" + "cloudAccountId=" + global::System.Uri.EscapeDataString(cloudAccountId.ToString()) + "&" + "projectName=" + global::System.Uri.EscapeDataString(projectName) + "&" + "instanceName=" + global::System.Uri.EscapeDataString(instanceName) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetGcpSpannerDatabasesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetGcpSpannerDatabasesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpDatabaseList>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpDatabaseList> GetGcpSpannerDatabasesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GcpDatabaseList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetGcpSpannerDatabases" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetGcpSpannerDatabases_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpDatabaseList>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GcpDatabaseList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetGcpSpannerDatabases" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="cloudAccountId">the id of the node where the browse request is sent</param> /// <param name="projectName">google cloud project the instance belongs to</param> /// <param name="instanceName">the google spanner instance name</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetGcpSpannerDatabases_Validate(long cloudAccountId, string projectName, string instanceName, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(projectName),projectName); await eventListener.AssertNotNull(nameof(instanceName),instanceName); } } /// <summary>To get the list of instances for GCP</summary> /// <param name="cloudAccountId">the google cloud hypervisor account id</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetGcpSpannerInstanceList(long cloudAccountId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpInstanceList>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GCPSpanner/instances" + "?" + "cloudAccountId=" + global::System.Uri.EscapeDataString(cloudAccountId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetGcpSpannerInstanceList_Call (request, onOk,eventListener,sender); } } /// <summary>To get the list of instances for GCP</summary> /// <param name="viaIdentity"></param> /// <param name="cloudAccountId">the google cloud hypervisor account id</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetGcpSpannerInstanceListViaIdentity(global::System.String viaIdentity, long cloudAccountId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpInstanceList>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/GCPSpanner/instances$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/GCPSpanner/instances'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GCPSpanner/instances" + "?" + "cloudAccountId=" + global::System.Uri.EscapeDataString(cloudAccountId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetGcpSpannerInstanceList_Call (request, onOk,eventListener,sender); } } /// <summary>To get the list of instances for GCP</summary> /// <param name="viaIdentity"></param> /// <param name="cloudAccountId">the google cloud hypervisor account id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpInstanceList>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpInstanceList> GetGcpSpannerInstanceListViaIdentityWithResult(global::System.String viaIdentity, long cloudAccountId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/GCPSpanner/instances$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/GCPSpanner/instances'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GCPSpanner/instances" + "?" + "cloudAccountId=" + global::System.Uri.EscapeDataString(cloudAccountId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetGcpSpannerInstanceListWithResult_Call (request, eventListener,sender); } } /// <summary>To get the list of instances for GCP</summary> /// <param name="cloudAccountId">the google cloud hypervisor account id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpInstanceList>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpInstanceList> GetGcpSpannerInstanceListWithResult(long cloudAccountId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GCPSpanner/instances" + "?" + "cloudAccountId=" + global::System.Uri.EscapeDataString(cloudAccountId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetGcpSpannerInstanceListWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetGcpSpannerInstanceListWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpInstanceList>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpInstanceList> GetGcpSpannerInstanceListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GcpInstanceList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetGcpSpannerInstanceList" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetGcpSpannerInstanceList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGcpInstanceList>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GcpInstanceList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetGcpSpannerInstanceList" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="cloudAccountId">the google cloud hypervisor account id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetGcpSpannerInstanceList_Validate(long cloudAccountId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get permission status for a cloudAccount on a GCP project</summary> /// <param name="cloudAccountId">the id of the node where the browse request is sent</param> /// <param name="projectName">google cloud project the instance belongs to</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetGcpSpannerPermissions(long? cloudAccountId, string projectName, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStatusModel>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GCPSpanner/permissions" + "?" + (null == cloudAccountId ? global::System.String.Empty : "cloudAccountId=" + global::System.Uri.EscapeDataString(cloudAccountId.ToString())) + "&" + (string.IsNullOrEmpty(projectName) ? global::System.String.Empty : "projectName=" + global::System.Uri.EscapeDataString(projectName)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetGcpSpannerPermissions_Call (request, onOk,eventListener,sender); } } /// <summary>Get permission status for a cloudAccount on a GCP project</summary> /// <param name="viaIdentity"></param> /// <param name="cloudAccountId">the id of the node where the browse request is sent</param> /// <param name="projectName">google cloud project the instance belongs to</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetGcpSpannerPermissionsViaIdentity(global::System.String viaIdentity, long? cloudAccountId, string projectName, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStatusModel>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/GCPSpanner/permissions$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/GCPSpanner/permissions'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GCPSpanner/permissions" + "?" + (null == cloudAccountId ? global::System.String.Empty : "cloudAccountId=" + global::System.Uri.EscapeDataString(cloudAccountId.ToString())) + "&" + (string.IsNullOrEmpty(projectName) ? global::System.String.Empty : "projectName=" + global::System.Uri.EscapeDataString(projectName)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetGcpSpannerPermissions_Call (request, onOk,eventListener,sender); } } /// <summary>Get permission status for a cloudAccount on a GCP project</summary> /// <param name="viaIdentity"></param> /// <param name="cloudAccountId">the id of the node where the browse request is sent</param> /// <param name="projectName">google cloud project the instance belongs to</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStatusModel>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStatusModel> GetGcpSpannerPermissionsViaIdentityWithResult(global::System.String viaIdentity, long? cloudAccountId, string projectName, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/GCPSpanner/permissions$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/GCPSpanner/permissions'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GCPSpanner/permissions" + "?" + (null == cloudAccountId ? global::System.String.Empty : "cloudAccountId=" + global::System.Uri.EscapeDataString(cloudAccountId.ToString())) + "&" + (string.IsNullOrEmpty(projectName) ? global::System.String.Empty : "projectName=" + global::System.Uri.EscapeDataString(projectName)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetGcpSpannerPermissionsWithResult_Call (request, eventListener,sender); } } /// <summary>Get permission status for a cloudAccount on a GCP project</summary> /// <param name="cloudAccountId">the id of the node where the browse request is sent</param> /// <param name="projectName">google cloud project the instance belongs to</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStatusModel>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStatusModel> GetGcpSpannerPermissionsWithResult(long? cloudAccountId, string projectName, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GCPSpanner/permissions" + "?" + (null == cloudAccountId ? global::System.String.Empty : "cloudAccountId=" + global::System.Uri.EscapeDataString(cloudAccountId.ToString())) + "&" + (string.IsNullOrEmpty(projectName) ? global::System.String.Empty : "projectName=" + global::System.Uri.EscapeDataString(projectName)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetGcpSpannerPermissionsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetGcpSpannerPermissionsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStatusModel>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStatusModel> GetGcpSpannerPermissionsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.StatusModel.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetGcpSpannerPermissions" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetGcpSpannerPermissions_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStatusModel>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.StatusModel.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetGcpSpannerPermissions" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="cloudAccountId">the id of the node where the browse request is sent</param> /// <param name="projectName">google cloud project the instance belongs to</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetGcpSpannerPermissions_Validate(long? cloudAccountId, string projectName, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(projectName),projectName); } } /// <summary>Get list of global execptions</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetGlobalExceptions(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetGlobalExceptions>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GlobalExceptions" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetGlobalExceptions_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetGlobalExceptions" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetGlobalExceptions_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetGlobalExceptions>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetGlobalExceptions.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetGlobalExceptions" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetGlobalExceptions_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get list of global settings used to modify system default behaviour</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetGlobalSettings(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalSettingsResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GlobalSettings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetGlobalSettings_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of global settings used to modify system default behaviour</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalSettingsResponse>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalSettingsResponse> GetGlobalSettingsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GlobalSettings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetGlobalSettingsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetGlobalSettingsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalSettingsResponse>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalSettingsResponse> GetGlobalSettingsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GlobalSettingsResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetGlobalSettings" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetGlobalSettings_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGlobalSettingsResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GlobalSettingsResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetGlobalSettings" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetGlobalSettings_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get Hybrid File Store Share Status</summary> /// <param name="hfsShareId">Id of the HFS Share to fetch its status</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetHybridFileStoreShareStatus(long hfsShareId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/HFSShare/" + (hfsShareId.ToString()) + "/Status" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetHybridFileStoreShareStatus_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>API to get Hybrid File Store Share Status</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetHybridFileStoreShareStatusViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/v4/HFSShare/(?<HFSShareId>[^/]+)/Status$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/v4/HFSShare/{HFSShareId}/Status'"); } // replace URI parameters with values from identity var hfsShareId = _match.Groups["HFSShareId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/HFSShare/" + hfsShareId + "/Status" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetHybridFileStoreShareStatus_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>API to get Hybrid File Store Share Status</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp> GetHybridFileStoreShareStatusViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/v4/HFSShare/(?<HFSShareId>[^/]+)/Status$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/v4/HFSShare/{HFSShareId}/Status'"); } // replace URI parameters with values from identity var hfsShareId = _match.Groups["HFSShareId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/HFSShare/" + hfsShareId + "/Status" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetHybridFileStoreShareStatusWithResult_Call (request, eventListener,sender); } } /// <summary>API to get Hybrid File Store Share Status</summary> /// <param name="hfsShareId">Id of the HFS Share to fetch its status</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp> GetHybridFileStoreShareStatusWithResult(long hfsShareId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/HFSShare/" + (hfsShareId.ToString()) + "/Status" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetHybridFileStoreShareStatusWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetHybridFileStoreShareStatusWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp> GetHybridFileStoreShareStatusWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.HfsShareStatusResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.HfsShareStatusResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.HfsShareStatusResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetHybridFileStoreShareStatus" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetHybridFileStoreShareStatus_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHfsShareStatusResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.HfsShareStatusResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.HfsShareStatusResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.HfsShareStatusResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetHybridFileStoreShareStatus" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="hfsShareId">Id of the HFS Share to fetch its status</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetHybridFileStoreShareStatus_Validate(long hfsShareId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get list of hybrid file stores</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetHybridFileStores(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHybridFileStoresListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/HybridFileStores" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetHybridFileStores_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of hybrid file stores</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHybridFileStoresListResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHybridFileStoresListResp> GetHybridFileStoresWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/HybridFileStores" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetHybridFileStoresWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetHybridFileStoresWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHybridFileStoresListResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHybridFileStoresListResp> GetHybridFileStoresWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.HybridFileStoresListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetHybridFileStores" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetHybridFileStores_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHybridFileStoresListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.HybridFileStoresListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetHybridFileStores" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetHybridFileStores_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details of a specific HyperScale Storage</summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="showInheritedAssociation">Set to true if want to show inherited security associations</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetHyperScaleStorageById(long hyperScaleStorageId, string showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHyperScaleStorageDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + (hyperScaleStorageId.ToString()) + "?" + (string.IsNullOrEmpty(showInheritedAssociation) ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetHyperScaleStorageById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Get details of a specific HyperScale Storage</summary> /// <param name="viaIdentity"></param> /// <param name="showInheritedAssociation">Set to true if want to show inherited security associations</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetHyperScaleStorageByIdViaIdentity(global::System.String viaIdentity, string showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHyperScaleStorageDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/HyperScale/(?<hyperScaleStorageId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/HyperScale/{hyperScaleStorageId}'"); } // replace URI parameters with values from identity var hyperScaleStorageId = _match.Groups["hyperScaleStorageId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + hyperScaleStorageId + "?" + (string.IsNullOrEmpty(showInheritedAssociation) ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetHyperScaleStorageById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetHyperScaleStorageById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetHyperScaleStorageById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHyperScaleStorageDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.HyperScaleStorageDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetHyperScaleStorageById" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="showInheritedAssociation">Set to true if want to show inherited security associations</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetHyperScaleStorageById_Validate(long hyperScaleStorageId, string showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(showInheritedAssociation),showInheritedAssociation); } } /// <summary>Get All HyperScale Storage</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetHyperScaleStorageList(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1BigzubV4StorageHyperscaleGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetHyperScaleStorageList_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetHyperScaleStorageList" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetHyperScaleStorageList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1BigzubV4StorageHyperscaleGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths1BigzubV4StorageHyperscaleGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetHyperScaleStorageList" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetHyperScaleStorageList_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get hypervisor filters</summary> /// <param name="hypervisorId"></param> /// <param name="backupsetId">if not specified the default backupset will be fetched</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetHypervisorFilter(long hypervisorId, string backupsetId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetHypervisorFilterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/hypervisor/" + (hypervisorId.ToString()) + "/filter" + "?" + (string.IsNullOrEmpty(backupsetId) ? global::System.String.Empty : "backupsetId=" + global::System.Uri.EscapeDataString(backupsetId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetHypervisorFilter_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get hypervisor filters</summary> /// <param name="viaIdentity"></param> /// <param name="backupsetId">if not specified the default backupset will be fetched</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetHypervisorFilterViaIdentity(global::System.String viaIdentity, string backupsetId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetHypervisorFilterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/v4/hypervisor/(?<hypervisorId>[^/]+)/filter$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/v4/hypervisor/{hypervisorId}/filter'"); } // replace URI parameters with values from identity var hypervisorId = _match.Groups["hypervisorId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/hypervisor/" + hypervisorId + "/filter" + "?" + (string.IsNullOrEmpty(backupsetId) ? global::System.String.Empty : "backupsetId=" + global::System.Uri.EscapeDataString(backupsetId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetHypervisorFilter_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetHypervisorFilter" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetHypervisorFilter_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetHypervisorFilterResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetHypervisorFilterResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetHypervisorFilter" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="hypervisorId"></param> /// <param name="backupsetId">if not specified the default backupset will be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetHypervisorFilter_Validate(long hypervisorId, string backupsetId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(backupsetId),backupsetId); } } /// <summary>Get the details of HYpervisor</summary> /// <param name="hypervisorId">Id of the HYpervisor to get</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetHypervisors(long hypervisorId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHypervisorPropertiesResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + (hypervisorId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetHypervisors_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get the details of HYpervisor</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetHypervisorsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHypervisorPropertiesResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Hypervisor/(?<hypervisorId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Hypervisor/{hypervisorId}'"); } // replace URI parameters with values from identity var hypervisorId = _match.Groups["hypervisorId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + hypervisorId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetHypervisors_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetHypervisors" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetHypervisors_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHypervisorPropertiesResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.HypervisorPropertiesResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetHypervisors" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="hypervisorId">Id of the HYpervisor to get</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetHypervisors_Validate(long hypervisorId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Retrieve job history for identity server asset</summary> /// <param name="inventoryId"></param> /// <param name="assetId">FQDN of the asset</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetIdentityServerAssetJobHistory(long inventoryId, string assetId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDatasourceJobHistory>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + (inventoryId.ToString()) + "/Assets/" + global::System.Uri.EscapeDataString(assetId) + "/jobs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetIdentityServerAssetJobHistory_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Retrieve job history for identity server asset</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetIdentityServerAssetJobHistoryViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDatasourceJobHistory>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/InventoryManager/Inventory/(?<inventoryId>[^/]+)/Assets/(?<assetId>[^/]+)/jobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/InventoryManager/Inventory/{inventoryId}/Assets/{assetId}/jobs'"); } // replace URI parameters with values from identity var inventoryId = _match.Groups["inventoryId"].Value; var assetId = _match.Groups["assetId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + inventoryId + "/Assets/" + assetId + "/jobs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetIdentityServerAssetJobHistory_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetIdentityServerAssetJobHistory" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetIdentityServerAssetJobHistory_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDatasourceJobHistory>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.DatasourceJobHistory.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetIdentityServerAssetJobHistory" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="inventoryId"></param> /// <param name="assetId">FQDN of the asset</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetIdentityServerAssetJobHistory_Validate(long inventoryId, string assetId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(assetId),assetId); } } /// <summary>Get identity servers list</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetIdentityServers(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdentityServersListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/IdentityServers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetIdentityServers_Call (request, onOk,eventListener,sender); } } /// <summary>Get identity servers list</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdentityServersListResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdentityServersListResp> GetIdentityServersWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/IdentityServers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetIdentityServersWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetIdentityServersWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdentityServersListResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdentityServersListResp> GetIdentityServersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdentityServersListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetIdentityServers" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetIdentityServers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdentityServersListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdentityServersListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetIdentityServers" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetIdentityServers_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get list of index servers</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetIndexServers(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIndexServersListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/IndexServers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetIndexServers_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of index servers</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIndexServersListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIndexServersListResp> GetIndexServersWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/IndexServers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetIndexServersWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetIndexServersWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIndexServersListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIndexServersListResp> GetIndexServersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IndexServersListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetIndexServers" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetIndexServers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIndexServersListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IndexServersListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetIndexServers" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetIndexServers_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to fetch all required details for performing Discover Media operation</summary> /// <param name="libraryId">Library ID of the Tape Storage</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetInfoForDiscoverMedia(long libraryId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDiscoverMediaInfoResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + (libraryId.ToString()) + "/MediaType" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetInfoForDiscoverMedia_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>API to fetch all required details for performing Discover Media operation</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetInfoForDiscoverMediaViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDiscoverMediaInfoResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Tape/(?<libraryId>[^/]+)/MediaType$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Tape/{libraryId}/MediaType'"); } // replace URI parameters with values from identity var libraryId = _match.Groups["libraryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + libraryId + "/MediaType" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetInfoForDiscoverMedia_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetInfoForDiscoverMedia" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetInfoForDiscoverMedia_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDiscoverMediaInfoResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.DiscoverMediaInfoResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetInfoForDiscoverMedia" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="libraryId">Library ID of the Tape Storage</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetInfoForDiscoverMedia_Validate(long libraryId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>This endpoint is used to return the list of instances.</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetInstances(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInstanceListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instances" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetInstances_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>This endpoint is used to return the list of instances.</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInstanceListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInstanceListResp> GetInstancesWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instances" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetInstancesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetInstancesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInstanceListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInstanceListResp> GetInstancesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.InstanceListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetInstances" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetInstances_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInstanceListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.InstanceListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetInstances" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetInstances_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get all instant clones</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetInstantClones(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInstantClonesListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InstantClones" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetInstantClones_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get all instant clones</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInstantClonesListResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInstantClonesListResp> GetInstantClonesWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InstantClones" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetInstantClonesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetInstantClonesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInstantClonesListResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInstantClonesListResp> GetInstantClonesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.InstantClonesListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetInstantClones" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetInstantClones_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInstantClonesListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.InstantClonesListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetInstantClones" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetInstantClones_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the details of inventory asset</summary> /// <param name="inventoryId"></param> /// <param name="assetId">FQDN of the asset</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetInventoryAssetDetails(long inventoryId, string assetId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryAssetDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + (inventoryId.ToString()) + "/Assets/" + global::System.Uri.EscapeDataString(assetId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetInventoryAssetDetails_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Get the details of inventory asset</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetInventoryAssetDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryAssetDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/InventoryManager/Inventory/(?<inventoryId>[^/]+)/Assets/(?<assetId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/InventoryManager/Inventory/{inventoryId}/Assets/{assetId}'"); } // replace URI parameters with values from identity var inventoryId = _match.Groups["inventoryId"].Value; var assetId = _match.Groups["assetId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + inventoryId + "/Assets/" + assetId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetInventoryAssetDetails_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetInventoryAssetDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetInventoryAssetDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryAssetDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.InventoryAssetDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetInventoryAssetDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="inventoryId"></param> /// <param name="assetId">FQDN of the asset</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetInventoryAssetDetails_Validate(long inventoryId, string assetId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(assetId),assetId); } } /// <summary>Get the list of assets associated to the inventory</summary> /// <param name="inventoryId">Inventory id</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetInventoryAssetList(long inventoryId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryAssetList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + (inventoryId.ToString()) + "/Assets" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetInventoryAssetList_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get the list of assets associated to the inventory</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetInventoryAssetListViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryAssetList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/InventoryManager/Inventory/(?<inventoryId>[^/]+)/Assets$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/InventoryManager/Inventory/{inventoryId}/Assets'"); } // replace URI parameters with values from identity var inventoryId = _match.Groups["inventoryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + inventoryId + "/Assets" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetInventoryAssetList_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetInventoryAssetList" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetInventoryAssetList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryAssetList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.InventoryAssetList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetInventoryAssetList" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="inventoryId">Inventory id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetInventoryAssetList_Validate(long inventoryId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get inventory details</summary> /// <param name="inventoryId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetInventoryDetails(long inventoryId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + (inventoryId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetInventoryDetails_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Get inventory details</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetInventoryDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/InventoryManager/Inventory/(?<inventoryId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/InventoryManager/Inventory/{inventoryId}'"); } // replace URI parameters with values from identity var inventoryId = _match.Groups["inventoryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + inventoryId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetInventoryDetails_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetInventoryDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetInventoryDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.InventoryDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetInventoryDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="inventoryId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetInventoryDetails_Validate(long inventoryId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Retrieve the list of inventories</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetInventoryList(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetInventoryList_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetInventoryList" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetInventoryList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IInventoryList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.InventoryList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetInventoryList" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetInventoryList_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the list of Jobs for selected backupDestinationId.</summary> /// <param name="backupDestinationId">Id of the BackupDestination to fetch Job List.</param> /// <param name="view">Time period selection for which to fetch jobs. Accepted values [last24Hours, lastWeek, lastMonth, last3Months, /// custom]. When custom is selected Jobs are filtered based on values provided in other params.</param> /// <param name="clients">Comma separated Client Ids to filter the jobs based on clients associated</param> /// <param name="agedData">Aged Jobs selection. Accepted values [ 0 to exclude aged jobs, 1 to show only aged jobs, 2 to include /// aged jobs].</param> /// <param name="backupLvl">Job backup type filter. Accepted values [1=Full, 2=Incremental, 4=Differential, 8=All, 64=Synthetic /// full].</param> /// <param name="copyState">Filter jobs by data status. Accepted values [0 = show all, 1 = show available, 4 = show to be /// copied, 8 = show not to be copied, 16 = show extended retained].</param> /// <param name="startTime">Start time of the time range.</param> /// <param name="endTime">End time of the time range.</param> /// <param name="minAppSizeMb">Minimum size of job in Megabytes for application size range filter</param> /// <param name="maxAppSizeMb">Maximum size of job in Megabytes for application size range filter</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetJobsOnBackupDestination(long backupDestinationId, string view, string clients, long? agedData, long? backupLvl, long? copyState, long? startTime, long? endTime, long? minAppSizeMb, long? maxAppSizeMb, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetJobsOnStorageResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + (backupDestinationId.ToString()) + "/Jobs" + "?" + (string.IsNullOrEmpty(view) ? global::System.String.Empty : "view=" + global::System.Uri.EscapeDataString(view)) + "&" + (string.IsNullOrEmpty(clients) ? global::System.String.Empty : "clients=" + global::System.Uri.EscapeDataString(clients)) + "&" + (null == agedData ? global::System.String.Empty : "agedData=" + global::System.Uri.EscapeDataString(agedData.ToString())) + "&" + (null == backupLvl ? global::System.String.Empty : "backupLvl=" + global::System.Uri.EscapeDataString(backupLvl.ToString())) + "&" + (null == copyState ? global::System.String.Empty : "copyState=" + global::System.Uri.EscapeDataString(copyState.ToString())) + "&" + (null == startTime ? global::System.String.Empty : "startTime=" + global::System.Uri.EscapeDataString(startTime.ToString())) + "&" + (null == endTime ? global::System.String.Empty : "endTime=" + global::System.Uri.EscapeDataString(endTime.ToString())) + "&" + (null == minAppSizeMb ? global::System.String.Empty : "minAppSizeMB=" + global::System.Uri.EscapeDataString(minAppSizeMb.ToString())) + "&" + (null == maxAppSizeMb ? global::System.String.Empty : "maxAppSizeMB=" + global::System.Uri.EscapeDataString(maxAppSizeMb.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetJobsOnBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get the list of Jobs for selected backupDestinationId.</summary> /// <param name="viaIdentity"></param> /// <param name="view">Time period selection for which to fetch jobs. Accepted values [last24Hours, lastWeek, lastMonth, last3Months, /// custom]. When custom is selected Jobs are filtered based on values provided in other params.</param> /// <param name="clients">Comma separated Client Ids to filter the jobs based on clients associated</param> /// <param name="agedData">Aged Jobs selection. Accepted values [ 0 to exclude aged jobs, 1 to show only aged jobs, 2 to include /// aged jobs].</param> /// <param name="backupLvl">Job backup type filter. Accepted values [1=Full, 2=Incremental, 4=Differential, 8=All, 64=Synthetic /// full].</param> /// <param name="copyState">Filter jobs by data status. Accepted values [0 = show all, 1 = show available, 4 = show to be /// copied, 8 = show not to be copied, 16 = show extended retained].</param> /// <param name="startTime">Start time of the time range.</param> /// <param name="endTime">End time of the time range.</param> /// <param name="minAppSizeMb">Minimum size of job in Megabytes for application size range filter</param> /// <param name="maxAppSizeMb">Maximum size of job in Megabytes for application size range filter</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetJobsOnBackupDestinationViaIdentity(global::System.String viaIdentity, string view, string clients, long? agedData, long? backupLvl, long? copyState, long? startTime, long? endTime, long? minAppSizeMb, long? maxAppSizeMb, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetJobsOnStorageResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/BackupDestination/(?<backupDestinationId>[^/]+)/Jobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/BackupDestination/{backupDestinationId}/Jobs'"); } // replace URI parameters with values from identity var backupDestinationId = _match.Groups["backupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + backupDestinationId + "/Jobs" + "?" + (string.IsNullOrEmpty(view) ? global::System.String.Empty : "view=" + global::System.Uri.EscapeDataString(view)) + "&" + (string.IsNullOrEmpty(clients) ? global::System.String.Empty : "clients=" + global::System.Uri.EscapeDataString(clients)) + "&" + (null == agedData ? global::System.String.Empty : "agedData=" + global::System.Uri.EscapeDataString(agedData.ToString())) + "&" + (null == backupLvl ? global::System.String.Empty : "backupLvl=" + global::System.Uri.EscapeDataString(backupLvl.ToString())) + "&" + (null == copyState ? global::System.String.Empty : "copyState=" + global::System.Uri.EscapeDataString(copyState.ToString())) + "&" + (null == startTime ? global::System.String.Empty : "startTime=" + global::System.Uri.EscapeDataString(startTime.ToString())) + "&" + (null == endTime ? global::System.String.Empty : "endTime=" + global::System.Uri.EscapeDataString(endTime.ToString())) + "&" + (null == minAppSizeMb ? global::System.String.Empty : "minAppSizeMB=" + global::System.Uri.EscapeDataString(minAppSizeMb.ToString())) + "&" + (null == maxAppSizeMb ? global::System.String.Empty : "maxAppSizeMB=" + global::System.Uri.EscapeDataString(maxAppSizeMb.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetJobsOnBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetJobsOnBackupDestination" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetJobsOnBackupDestination_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetJobsOnStorageResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetJobsOnStorageResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetJobsOnBackupDestination" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="backupDestinationId">Id of the BackupDestination to fetch Job List.</param> /// <param name="view">Time period selection for which to fetch jobs. Accepted values [last24Hours, lastWeek, lastMonth, last3Months, /// custom]. When custom is selected Jobs are filtered based on values provided in other params.</param> /// <param name="clients">Comma separated Client Ids to filter the jobs based on clients associated</param> /// <param name="agedData">Aged Jobs selection. Accepted values [ 0 to exclude aged jobs, 1 to show only aged jobs, 2 to include /// aged jobs].</param> /// <param name="backupLvl">Job backup type filter. Accepted values [1=Full, 2=Incremental, 4=Differential, 8=All, 64=Synthetic /// full].</param> /// <param name="copyState">Filter jobs by data status. Accepted values [0 = show all, 1 = show available, 4 = show to be /// copied, 8 = show not to be copied, 16 = show extended retained].</param> /// <param name="startTime">Start time of the time range.</param> /// <param name="endTime">End time of the time range.</param> /// <param name="minAppSizeMb">Minimum size of job in Megabytes for application size range filter</param> /// <param name="maxAppSizeMb">Maximum size of job in Megabytes for application size range filter</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetJobsOnBackupDestination_Validate(long backupDestinationId, string view, string clients, long? agedData, long? backupLvl, long? copyState, long? startTime, long? endTime, long? minAppSizeMb, long? maxAppSizeMb, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(view),view); await eventListener.AssertNotNull(nameof(clients),clients); } } /// <summary>Get key management servers</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetKeyManagementServers(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1Ir1YhfV4KeymanagementserversGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/KeyManagementServers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetKeyManagementServers_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetKeyManagementServers" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetKeyManagementServers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1Ir1YhfV4KeymanagementserversGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths1Ir1YhfV4KeymanagementserversGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetKeyManagementServers" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetKeyManagementServers_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get details of a Kubernetes application</summary> /// <param name="appGuid">GUID of the Application to get details</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetKubernetesAppDetails(string appGuid, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesApplicationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Application/" + global::System.Uri.EscapeDataString(appGuid) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetKubernetesAppDetails_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>API to get details of a Kubernetes application</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetKubernetesAppDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesApplicationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Application/(?<appGUID>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Application/{appGUID}'"); } // replace URI parameters with values from identity var appGuid = _match.Groups["appGUID"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Application/" + appGuid ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetKubernetesAppDetails_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetKubernetesAppDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetKubernetesAppDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesApplicationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.KubernetesApplicationDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetKubernetesAppDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="appGuid">GUID of the Application to get details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetKubernetesAppDetails_Validate(string appGuid, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(appGuid),appGuid); } } /// <summary>Get all application in Kubenetes cluster</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetKubernetesApplication(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IApplicationListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/Applications" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetKubernetesApplication_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get all application in Kubenetes cluster</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IApplicationListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IApplicationListResp> GetKubernetesApplicationWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/Applications" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetKubernetesApplicationWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetKubernetesApplicationWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IApplicationListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IApplicationListResp> GetKubernetesApplicationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ApplicationListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetKubernetesApplication" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetKubernetesApplication_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IApplicationListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ApplicationListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetKubernetesApplication" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetKubernetesApplication_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get details of a Kubernetes clusters with clusterId</summary> /// <param name="clusterId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetKubernetesClusterDetails(long clusterId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetClusterDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + (clusterId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetKubernetesClusterDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to get details of a Kubernetes clusters with clusterId</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetKubernetesClusterDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetClusterDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Cluster/(?<clusterId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Cluster/{clusterId}'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + clusterId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetKubernetesClusterDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetKubernetesClusterDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetKubernetesClusterDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetClusterDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetClusterDetailsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetKubernetesClusterDetails" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="clusterId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetKubernetesClusterDetails_Validate(long clusterId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get Backup Destinations for a Plan</summary> /// <param name="planId">Id of the Laptop Plan to retrieve backup destinations</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLaptopBackupDestinations(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) + "/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLaptopBackupDestinations_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get Backup Destinations for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLaptopBackupDestinationsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)/BackupDestinations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}/BackupDestinations'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId + "/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLaptopBackupDestinations_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get Backup Destinations for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations> GetLaptopBackupDestinationsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)/BackupDestinations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}/BackupDestinations'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId + "/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetLaptopBackupDestinationsWithResult_Call (request, eventListener,sender); } } /// <summary>Get Backup Destinations for a Plan</summary> /// <param name="planId">Id of the Laptop Plan to retrieve backup destinations</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations> GetLaptopBackupDestinationsWithResult(long planId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) + "/BackupDestinations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetLaptopBackupDestinationsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetLaptopBackupDestinationsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations> GetLaptopBackupDestinationsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinations.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetLaptopBackupDestinations" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLaptopBackupDestinations_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinations>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinations.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetLaptopBackupDestinations" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="planId">Id of the Laptop Plan to retrieve backup destinations</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLaptopBackupDestinations_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get list of laptops</summary> /// <param name="edgemode"></param> /// <param name="additionalProperties"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLaptopList(bool? edgemode, bool? additionalProperties, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.ILaptopsAdminConsole>>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Laptop" + "?" + (null == edgemode ? global::System.String.Empty : "edgemode=" + global::System.Uri.EscapeDataString(edgemode.ToString())) + "&" + (null == additionalProperties ? global::System.String.Empty : "additionalProperties=" + global::System.Uri.EscapeDataString(additionalProperties.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLaptopList_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of laptops</summary> /// <param name="viaIdentity"></param> /// <param name="edgemode"></param> /// <param name="additionalProperties"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLaptopListViaIdentity(global::System.String viaIdentity, bool? edgemode, bool? additionalProperties, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.ILaptopsAdminConsole>>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Laptop$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Laptop'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Laptop" + "?" + (null == edgemode ? global::System.String.Empty : "edgemode=" + global::System.Uri.EscapeDataString(edgemode.ToString())) + "&" + (null == additionalProperties ? global::System.String.Empty : "additionalProperties=" + global::System.Uri.EscapeDataString(additionalProperties.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLaptopList_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of laptops</summary> /// <param name="viaIdentity"></param> /// <param name="edgemode"></param> /// <param name="additionalProperties"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.ILaptopsAdminConsole>>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.ILaptopsAdminConsole>> GetLaptopListViaIdentityWithResult(global::System.String viaIdentity, bool? edgemode, bool? additionalProperties, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Laptop$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Laptop'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Laptop" + "?" + (null == edgemode ? global::System.String.Empty : "edgemode=" + global::System.Uri.EscapeDataString(edgemode.ToString())) + "&" + (null == additionalProperties ? global::System.String.Empty : "additionalProperties=" + global::System.Uri.EscapeDataString(additionalProperties.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetLaptopListWithResult_Call (request, eventListener,sender); } } /// <summary>Get list of laptops</summary> /// <param name="edgemode"></param> /// <param name="additionalProperties"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.ILaptopsAdminConsole>>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.ILaptopsAdminConsole>> GetLaptopListWithResult(bool? edgemode, bool? additionalProperties, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Laptop" + "?" + (null == edgemode ? global::System.String.Empty : "edgemode=" + global::System.Uri.EscapeDataString(edgemode.ToString())) + "&" + (null == additionalProperties ? global::System.String.Empty : "additionalProperties=" + global::System.Uri.EscapeDataString(additionalProperties.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetLaptopListWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetLaptopListWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.ILaptopsAdminConsole>>" /// /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.ILaptopsAdminConsole>> GetLaptopListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => If( Commvault.Powershell.Runtime.Json.JsonArray.Parse(body.Result) as Commvault.Powershell.Runtime.Json.JsonArray, out var __y) ? new global::System.Func<System.Collections.Generic.List<Commvault.Powershell.Models.ILaptopsAdminConsole>>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__y, (__x)=>(Commvault.Powershell.Models.ILaptopsAdminConsole) (Commvault.Powershell.Models.LaptopsAdminConsole.FromJson(__x) )) ))() : null); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetLaptopList" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLaptopList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.ILaptopsAdminConsole>>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => If( Commvault.Powershell.Runtime.Json.JsonArray.Parse(body.Result) as Commvault.Powershell.Runtime.Json.JsonArray, out var __y) ? new global::System.Func<System.Collections.Generic.List<Commvault.Powershell.Models.ILaptopsAdminConsole>>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__y, (__x)=>(Commvault.Powershell.Models.ILaptopsAdminConsole) (Commvault.Powershell.Models.LaptopsAdminConsole.FromJson(__x) )) ))() : null)); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetLaptopList" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="edgemode"></param> /// <param name="additionalProperties"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLaptopList_Validate(bool? edgemode, bool? additionalProperties, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get the list of laptop owner mappings</summary> /// <param name="companyId">Id of the company for which the laptop owner mapping needs to be returned</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLaptopOwnerMapping(long? companyId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILaptopOwnerMapping>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopOwnerMapping" + "?" + (null == companyId ? global::System.String.Empty : "companyId=" + global::System.Uri.EscapeDataString(companyId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLaptopOwnerMapping_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>API to get the list of laptop owner mappings</summary> /// <param name="viaIdentity"></param> /// <param name="companyId">Id of the company for which the laptop owner mapping needs to be returned</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLaptopOwnerMappingViaIdentity(global::System.String viaIdentity, long? companyId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILaptopOwnerMapping>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopOwnerMapping$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopOwnerMapping'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopOwnerMapping" + "?" + (null == companyId ? global::System.String.Empty : "companyId=" + global::System.Uri.EscapeDataString(companyId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLaptopOwnerMapping_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetLaptopOwnerMapping" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLaptopOwnerMapping_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILaptopOwnerMapping>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.LaptopOwnerMapping.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetLaptopOwnerMapping" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="companyId">Id of the company for which the laptop owner mapping needs to be returned</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLaptopOwnerMapping_Validate(long? companyId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get Laptop Plan details</summary> /// <param name="planId">Id of the plan</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLaptopPlanById(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILaptopPlanDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLaptopPlanById_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get Laptop Plan details</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLaptopPlanByIdViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILaptopPlanDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLaptopPlanById_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetLaptopPlanById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLaptopPlanById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILaptopPlanDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.LaptopPlanDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetLaptopPlanById" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLaptopPlanById_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>This endpoint returns license information</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLicenseInfo(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILicenseInfo>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/License" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLicenseInfo_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetLicenseInfo" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLicenseInfo_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILicenseInfo>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.LicenseInfo.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetLicenseInfo" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLicenseInfo_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get license usage details for a license type</summary> /// <param name="licenseType">License type for which usage details are required</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLicenseUsage(string licenseType, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILicenseUsageDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/LicenseUsage" + "?" + "licenseType=" + global::System.Uri.EscapeDataString(licenseType) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLicenseUsage_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get license usage details for a license type</summary> /// <param name="viaIdentity"></param> /// <param name="licenseType">License type for which usage details are required</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLicenseUsageViaIdentity(global::System.String viaIdentity, string licenseType, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILicenseUsageDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/LicenseUsage$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/LicenseUsage'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/LicenseUsage" + "?" + "licenseType=" + global::System.Uri.EscapeDataString(licenseType) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLicenseUsage_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetLicenseUsage" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLicenseUsage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILicenseUsageDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.LicenseUsageDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetLicenseUsage" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="licenseType">License type for which usage details are required</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLicenseUsage_Validate(string licenseType, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(licenseType),licenseType); } } /// <summary>Get a list of all the roles</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetListOfRoles(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRoleListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetListOfRoles_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get a list of all the roles</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRoleListResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRoleListResponse> GetListOfRolesWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetListOfRolesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetListOfRolesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRoleListResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRoleListResponse> GetListOfRolesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RoleListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetListOfRoles" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetListOfRoles_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRoleListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RoleListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetListOfRoles" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetListOfRoles_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Fetches the list of clones for the given bucket id</summary> /// <param name="id">ID of the bucket</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetListS3BucketClone(long id, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListCvfss3BucketCloneResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + (id.ToString()) + "/Clone" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetListS3BucketClone_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Fetches the list of clones for the given bucket id</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetListS3BucketCloneViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListCvfss3BucketCloneResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CVFS/S3Bucket/(?<id>[^/]+)/Clone$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CVFS/S3Bucket/{id}/Clone'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + id + "/Clone" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetListS3BucketClone_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetListS3BucketClone" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetListS3BucketClone_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListCvfss3BucketCloneResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ListCvfss3BucketCloneResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetListS3BucketClone" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id">ID of the bucket</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetListS3BucketClone_Validate(long id, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to fetch mount path details of the local storage pool</summary> /// <param name="storagePoolId">Id of the local storage pool whose details have to be fetched</param> /// <param name="backupLocationId">Id of the backup location whose details have to be fetched</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLocalBackupLocationDetails(long storagePoolId, long backupLocationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLocalBackupLocationDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to fetch mount path details of the local storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLocalBackupLocationDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation/{backupLocationId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation/" + backupLocationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLocalBackupLocationDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to fetch mount path details of the local storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails> GetLocalBackupLocationDetailsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation/{backupLocationId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation/" + backupLocationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetLocalBackupLocationDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Used to fetch mount path details of the local storage pool</summary> /// <param name="storagePoolId">Id of the local storage pool whose details have to be fetched</param> /// <param name="backupLocationId">Id of the backup location whose details have to be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails> GetLocalBackupLocationDetailsWithResult(long storagePoolId, long backupLocationId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetLocalBackupLocationDetailsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetLocalBackupLocationDetailsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails> GetLocalBackupLocationDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.BackupLocationDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetLocalBackupLocationDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLocalBackupLocationDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IBackupLocationDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.BackupLocationDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetLocalBackupLocationDetails" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="storagePoolId">Id of the local storage pool whose details have to be fetched</param> /// <param name="backupLocationId">Id of the backup location whose details have to be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLocalBackupLocationDetails_Validate(long storagePoolId, long backupLocationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details of a local storage pool based on id.</summary> /// <param name="storagePoolId">Id of the local storage pool whose details have to be fetched</param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLocalStorageDetails(long storagePoolId, bool? showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalStorage>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLocalStorageDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Get details of a local storage pool based on id.</summary> /// <param name="viaIdentity"></param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLocalStorageDetailsViaIdentity(global::System.String viaIdentity, bool? showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalStorage>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLocalStorageDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Get details of a local storage pool based on id.</summary> /// <param name="viaIdentity"></param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalStorage>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalStorage> GetLocalStorageDetailsViaIdentityWithResult(global::System.String viaIdentity, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetLocalStorageDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get details of a local storage pool based on id.</summary> /// <param name="storagePoolId">Id of the local storage pool whose details have to be fetched</param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalStorage>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalStorage> GetLocalStorageDetailsWithResult(long storagePoolId, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetLocalStorageDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetLocalStorageDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalStorage>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalStorage> GetLocalStorageDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.LocalStorage.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetLocalStorageDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLocalStorageDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocalStorage>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.LocalStorage.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetLocalStorageDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the local storage pool whose details have to be fetched</param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLocalStorageDetails_Validate(long storagePoolId, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get a list of Local storage pools</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetLocalStorages(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetLocalStorages_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get a list of Local storage pools</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageListResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageListResponse> GetLocalStoragesWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetLocalStoragesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetLocalStoragesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageListResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageListResponse> GetLocalStoragesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.StorageListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetLocalStorages" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLocalStorages_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.StorageListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetLocalStorages" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetLocalStorages_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Fetch the list of DDB disks hosted on the MediaAgent</summary> /// <param name="mediaAgentId">Id of the MediaAgent</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetMediaAgentDdbDisks(long mediaAgentId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMaddbDiskMgmtResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + (mediaAgentId.ToString()) + "/DDB/Disks" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetMediaAgentDdbDisks_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Fetch the list of DDB disks hosted on the MediaAgent</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetMediaAgentDdbDisksViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMaddbDiskMgmtResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/mediaAgent/(?<mediaAgentId>[^/]+)/DDB/Disks$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/mediaAgent/{mediaAgentId}/DDB/Disks'"); } // replace URI parameters with values from identity var mediaAgentId = _match.Groups["mediaAgentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + mediaAgentId + "/DDB/Disks" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetMediaAgentDdbDisks_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetMediaAgentDdbDisks" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetMediaAgentDdbDisks_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMaddbDiskMgmtResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MaddbDiskMgmtResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetMediaAgentDdbDisks" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="mediaAgentId">Id of the MediaAgent</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetMediaAgentDdbDisks_Validate(long mediaAgentId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details of a media agent based on id</summary> /// <param name="mediaAgentId">Id of the Media Agent whose details have to be fetched</param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetMediaAgentDetails(long mediaAgentId, bool? showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgent>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + (mediaAgentId.ToString()) + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetMediaAgentDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a media agent based on id</summary> /// <param name="viaIdentity"></param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetMediaAgentDetailsViaIdentity(global::System.String viaIdentity, bool? showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgent>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/mediaAgent/(?<mediaAgentId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/mediaAgent/{mediaAgentId}'"); } // replace URI parameters with values from identity var mediaAgentId = _match.Groups["mediaAgentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + mediaAgentId + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetMediaAgentDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a media agent based on id</summary> /// <param name="viaIdentity"></param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgent>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgent> GetMediaAgentDetailsViaIdentityWithResult(global::System.String viaIdentity, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/mediaAgent/(?<mediaAgentId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/mediaAgent/{mediaAgentId}'"); } // replace URI parameters with values from identity var mediaAgentId = _match.Groups["mediaAgentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + mediaAgentId + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetMediaAgentDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get details of a media agent based on id</summary> /// <param name="mediaAgentId">Id of the Media Agent whose details have to be fetched</param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgent>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgent> GetMediaAgentDetailsWithResult(long mediaAgentId, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + (mediaAgentId.ToString()) + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetMediaAgentDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetMediaAgentDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgent>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgent> GetMediaAgentDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MediaAgent.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetMediaAgentDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetMediaAgentDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgent>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MediaAgent.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetMediaAgentDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="mediaAgentId">Id of the Media Agent whose details have to be fetched</param> /// <param name="showInheritedAssociation">Show inherited security association</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetMediaAgentDetails_Validate(long mediaAgentId, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get All Media Agents</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetMediaAgents(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetMediaAgents_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Media Agents for DDB</summary> /// <param name="fetchDdbDisks">If set to true then fetch the list of DDB disks hosted on each MediaAgent</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetMediaAgentsForDdb(bool? fetchDdbDisks, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentForDdbListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DDB/MediaAgents" + "?" + (null == fetchDdbDisks ? global::System.String.Empty : "fetchDDBDisks=" + global::System.Uri.EscapeDataString(fetchDdbDisks.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetMediaAgentsForDdb_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Media Agents for DDB</summary> /// <param name="viaIdentity"></param> /// <param name="fetchDdbDisks">If set to true then fetch the list of DDB disks hosted on each MediaAgent</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetMediaAgentsForDdbViaIdentity(global::System.String viaIdentity, bool? fetchDdbDisks, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentForDdbListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/DDB/MediaAgents$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/DDB/MediaAgents'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DDB/MediaAgents" + "?" + (null == fetchDdbDisks ? global::System.String.Empty : "fetchDDBDisks=" + global::System.Uri.EscapeDataString(fetchDdbDisks.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetMediaAgentsForDdb_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Media Agents for DDB</summary> /// <param name="viaIdentity"></param> /// <param name="fetchDdbDisks">If set to true then fetch the list of DDB disks hosted on each MediaAgent</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentForDdbListResponse>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentForDdbListResponse> GetMediaAgentsForDdbViaIdentityWithResult(global::System.String viaIdentity, bool? fetchDdbDisks, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/DDB/MediaAgents$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/DDB/MediaAgents'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DDB/MediaAgents" + "?" + (null == fetchDdbDisks ? global::System.String.Empty : "fetchDDBDisks=" + global::System.Uri.EscapeDataString(fetchDdbDisks.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetMediaAgentsForDdbWithResult_Call (request, eventListener,sender); } } /// <summary>Get All Media Agents for DDB</summary> /// <param name="fetchDdbDisks">If set to true then fetch the list of DDB disks hosted on each MediaAgent</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentForDdbListResponse>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentForDdbListResponse> GetMediaAgentsForDdbWithResult(bool? fetchDdbDisks, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DDB/MediaAgents" + "?" + (null == fetchDdbDisks ? global::System.String.Empty : "fetchDDBDisks=" + global::System.Uri.EscapeDataString(fetchDdbDisks.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetMediaAgentsForDdbWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetMediaAgentsForDdbWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentForDdbListResponse>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentForDdbListResponse> GetMediaAgentsForDdbWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MediaAgentForDdbListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetMediaAgentsForDdb" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetMediaAgentsForDdb_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentForDdbListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MediaAgentForDdbListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetMediaAgentsForDdb" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="fetchDdbDisks">If set to true then fetch the list of DDB disks hosted on each MediaAgent</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetMediaAgentsForDdb_Validate(bool? fetchDdbDisks, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get All Media Agents</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentListResponse>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentListResponse> GetMediaAgentsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetMediaAgentsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetMediaAgentsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentListResponse>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentListResponse> GetMediaAgentsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MediaAgentListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetMediaAgents" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetMediaAgents_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MediaAgentListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetMediaAgents" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetMediaAgents_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the list of media for given library.</summary> /// <param name="libraryId">Id of Library</param> /// <param name="filterMediaType">Filter media list to given FilterMediaType</param> /// <param name="isExported">List "Media In Library" only if isExported is set to false otherwise list "Exported Media"</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetMediaListForLibrary(long libraryId, string filterMediaType, bool isExported, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetMediaListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Library/" + (libraryId.ToString()) + "/Media" + "?" + "filterMediaType=" + global::System.Uri.EscapeDataString(filterMediaType) + "&" + "isExported=" + global::System.Uri.EscapeDataString(isExported.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetMediaListForLibrary_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Get the list of media for given library.</summary> /// <param name="viaIdentity"></param> /// <param name="filterMediaType">Filter media list to given FilterMediaType</param> /// <param name="isExported">List "Media In Library" only if isExported is set to false otherwise list "Exported Media"</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetMediaListForLibraryViaIdentity(global::System.String viaIdentity, string filterMediaType, bool isExported, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetMediaListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Library/(?<libraryId>[^/]+)/Media$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Library/{libraryId}/Media'"); } // replace URI parameters with values from identity var libraryId = _match.Groups["libraryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Library/" + libraryId + "/Media" + "?" + "filterMediaType=" + global::System.Uri.EscapeDataString(filterMediaType) + "&" + "isExported=" + global::System.Uri.EscapeDataString(isExported.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetMediaListForLibrary_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetMediaListForLibrary" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetMediaListForLibrary_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetMediaListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetMediaListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetMediaListForLibrary" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="libraryId">Id of Library</param> /// <param name="filterMediaType">Filter media list to given FilterMediaType</param> /// <param name="isExported">List "Media In Library" only if isExported is set to false otherwise list "Exported Media"</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetMediaListForLibrary_Validate(long libraryId, string filterMediaType, bool isExported, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(filterMediaType),filterMediaType); } } /// <summary>API to get mountpath content</summary> /// <param name="mountPathId">Mountpath Id</param> /// <param name="deviceId">Device Id</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetMountPathContent(long? mountPathId, long? deviceId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetMountPathContentResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/MountPath/Content" + "?" + (null == mountPathId ? global::System.String.Empty : "mountPathId=" + global::System.Uri.EscapeDataString(mountPathId.ToString())) + "&" + (null == deviceId ? global::System.String.Empty : "deviceId=" + global::System.Uri.EscapeDataString(deviceId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetMountPathContent_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to get mountpath content</summary> /// <param name="viaIdentity"></param> /// <param name="mountPathId">Mountpath Id</param> /// <param name="deviceId">Device Id</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetMountPathContentViaIdentity(global::System.String viaIdentity, long? mountPathId, long? deviceId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetMountPathContentResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/MountPath/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/MountPath/Content'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/MountPath/Content" + "?" + (null == mountPathId ? global::System.String.Empty : "mountPathId=" + global::System.Uri.EscapeDataString(mountPathId.ToString())) + "&" + (null == deviceId ? global::System.String.Empty : "deviceId=" + global::System.Uri.EscapeDataString(deviceId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetMountPathContent_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetMountPathContent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetMountPathContent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetMountPathContentResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetMountPathContentResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetMountPathContent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="mountPathId">Mountpath Id</param> /// <param name="deviceId">Device Id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetMountPathContent_Validate(long? mountPathId, long? deviceId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Retrieve List of MultiCommCells</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetMultiCommCellInfo(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMultiCommCellInfoResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/MultiCommCell" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetMultiCommCellInfo_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Retrieve List of MultiCommCells</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMultiCommCellInfoResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMultiCommCellInfoResp> GetMultiCommCellInfoWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/MultiCommCell" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetMultiCommCellInfoWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetMultiCommCellInfoWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMultiCommCellInfoResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMultiCommCellInfoResp> GetMultiCommCellInfoWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MultiCommCellInfoResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetMultiCommCellInfo" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetMultiCommCellInfo_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMultiCommCellInfoResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MultiCommCellInfoResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetMultiCommCellInfo" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetMultiCommCellInfo_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details of a specific node of a hyperscale storage</summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="nodeId">Id of node</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetNodeDetailsOfHyperScaleStorage(long hyperScaleStorageId, long nodeId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHyperScaleNodeDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + (hyperScaleStorageId.ToString()) + "/Node/" + (nodeId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetNodeDetailsOfHyperScaleStorage_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a specific node of a hyperscale storage</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetNodeDetailsOfHyperScaleStorageViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHyperScaleNodeDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/HyperScale/(?<hyperScaleStorageId>[^/]+)/Node/(?<nodeId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/HyperScale/{hyperScaleStorageId}/Node/{nodeId}'"); } // replace URI parameters with values from identity var hyperScaleStorageId = _match.Groups["hyperScaleStorageId"].Value; var nodeId = _match.Groups["nodeId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + hyperScaleStorageId + "/Node/" + nodeId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetNodeDetailsOfHyperScaleStorage_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetNodeDetailsOfHyperScaleStorage" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetNodeDetailsOfHyperScaleStorage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IHyperScaleNodeDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.HyperScaleNodeDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetNodeDetailsOfHyperScaleStorage" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="nodeId">Id of node</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetNodeDetailsOfHyperScaleStorage_Validate(long hyperScaleStorageId, long nodeId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get Object Store Plan details</summary> /// <param name="planId">Id of the object store plan to fetch details</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetObjectStorePlanId(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IObjectStorePlan>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ObjectStorePlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetObjectStorePlanId_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get Object Store Plan details</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetObjectStorePlanIdViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IObjectStorePlan>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ObjectStorePlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ObjectStorePlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ObjectStorePlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetObjectStorePlanId_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get Object Store Plan details</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IObjectStorePlan>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IObjectStorePlan> GetObjectStorePlanIdViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ObjectStorePlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ObjectStorePlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ObjectStorePlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetObjectStorePlanIdWithResult_Call (request, eventListener,sender); } } /// <summary>Get Object Store Plan details</summary> /// <param name="planId">Id of the object store plan to fetch details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IObjectStorePlan>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IObjectStorePlan> GetObjectStorePlanIdWithResult(long planId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ObjectStorePlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetObjectStorePlanIdWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetObjectStorePlanIdWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IObjectStorePlan>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IObjectStorePlan> GetObjectStorePlanIdWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ObjectStorePlan.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetObjectStorePlanId" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetObjectStorePlanId_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IObjectStorePlan>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ObjectStorePlan.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetObjectStorePlanId" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the object store plan to fetch details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetObjectStorePlanId_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get list of Office 365 apps</summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetOffice365Client(long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365AllClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetOffice365Client_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of Office 365 apps</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetOffice365ClientViaIdentity(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365AllClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetOffice365Client_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of Office 365 apps</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365AllClientsResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365AllClientsResp> GetOffice365ClientViaIdentityWithResult(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetOffice365ClientWithResult_Call (request, eventListener,sender); } } /// <summary>Get list of Office 365 apps</summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365AllClientsResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365AllClientsResp> GetOffice365ClientWithResult(long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetOffice365ClientWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetOffice365ClientWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365AllClientsResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365AllClientsResp> GetOffice365ClientWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365AllClientsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetOffice365Client" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetOffice365Client_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365AllClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365AllClientsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetOffice365Client" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetOffice365Client_Validate(long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(sort),sort); await eventListener.AssertNotNull(nameof(searchKey),searchKey); } } /// <summary> /// Returns all Office365 active plans with number of entities associated to the plan per workload /// </summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetOffice365PlanDashboard(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365PlanSummaryListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Plans" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetOffice365PlanDashboard_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetOffice365PlanDashboard" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetOffice365PlanDashboard_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365PlanSummaryListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365PlanSummaryListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetOffice365PlanDashboard" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetOffice365PlanDashboard_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get list of Office 365 Onedrive for Business apps</summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetOnedriveClient(long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/OneDrive" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetOnedriveClient_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of Office 365 Onedrive for Business apps</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetOnedriveClientViaIdentity(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/OneDrive$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/OneDrive'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/OneDrive" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetOnedriveClient_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of Office 365 Onedrive for Business apps</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp> GetOnedriveClientViaIdentityWithResult(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/OneDrive$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/OneDrive'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/OneDrive" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetOnedriveClientWithResult_Call (request, eventListener,sender); } } /// <summary>Get list of Office 365 Onedrive for Business apps</summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp> GetOnedriveClientWithResult(long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/OneDrive" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetOnedriveClientWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetOnedriveClientWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp> GetOnedriveClientWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365ClientsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetOnedriveClient" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetOnedriveClient_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365ClientsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetOnedriveClient" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetOnedriveClient_Validate(long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(sort),sort); await eventListener.AssertNotNull(nameof(searchKey),searchKey); } } /// <summary>Get Office 365 Onedrive for Business Content</summary> /// <param name="appId">Commvault onedrive app id</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetOnedriveContent(long appId, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveContentResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/OneDrive/" + (appId.ToString()) + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetOnedriveContent_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Onedrive for Business Content</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetOnedriveContentViaIdentity(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveContentResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/OneDrive/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/OneDrive/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/OneDrive/" + appId + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetOnedriveContent_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Onedrive for Business Content</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveContentResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveContentResp> GetOnedriveContentViaIdentityWithResult(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/OneDrive/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/OneDrive/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/OneDrive/" + appId + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetOnedriveContentWithResult_Call (request, eventListener,sender); } } /// <summary>Get Office 365 Onedrive for Business Content</summary> /// <param name="appId">Commvault onedrive app id</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveContentResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveContentResp> GetOnedriveContentWithResult(long appId, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/OneDrive/" + (appId.ToString()) + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetOnedriveContentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetOnedriveContentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveContentResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveContentResp> GetOnedriveContentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365OnedriveContentResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetOnedriveContent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetOnedriveContent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveContentResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365OnedriveContentResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetOnedriveContent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="appId">Commvault onedrive app id</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetOnedriveContent_Validate(long appId, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(sort),sort); await eventListener.AssertNotNull(nameof(searchKey),searchKey); } } /// <summary>Get Office 365 Onedrive for Business Users</summary> /// <param name="appId">Commvault onedrive app id</param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetOnedriveUsers(long appId, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveUsersResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Onedrive/" + (appId.ToString()) + "/Users" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetOnedriveUsers_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Onedrive for Business Users</summary> /// <param name="viaIdentity"></param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetOnedriveUsersViaIdentity(global::System.String viaIdentity, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveUsersResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Onedrive/(?<appId>[^/]+)/Users$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Onedrive/{appId}/Users'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Onedrive/" + appId + "/Users" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetOnedriveUsers_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Onedrive for Business Users</summary> /// <param name="viaIdentity"></param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveUsersResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveUsersResp> GetOnedriveUsersViaIdentityWithResult(global::System.String viaIdentity, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Onedrive/(?<appId>[^/]+)/Users$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Onedrive/{appId}/Users'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Onedrive/" + appId + "/Users" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetOnedriveUsersWithResult_Call (request, eventListener,sender); } } /// <summary>Get Office 365 Onedrive for Business Users</summary> /// <param name="appId">Commvault onedrive app id</param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveUsersResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveUsersResp> GetOnedriveUsersWithResult(long appId, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Onedrive/" + (appId.ToString()) + "/Users" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetOnedriveUsersWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetOnedriveUsersWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveUsersResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveUsersResp> GetOnedriveUsersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365OnedriveUsersResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetOnedriveUsers" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetOnedriveUsers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365OnedriveUsersResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365OnedriveUsersResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetOnedriveUsers" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="appId">Commvault onedrive app id</param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetOnedriveUsers_Validate(long appId, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(propertyLevel),propertyLevel); await eventListener.AssertNotNull(nameof(sort),sort); await eventListener.AssertNotNull(nameof(searchKey),searchKey); } } /// <summary>Get a list of categories and permissions in each category</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetPermissionResponse(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPermissionListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Permissions" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetPermissionResponse_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get a list of categories and permissions in each category</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPermissionListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPermissionListResp> GetPermissionResponseWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Permissions" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetPermissionResponseWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetPermissionResponseWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPermissionListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPermissionListResp> GetPermissionResponseWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PermissionListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetPermissionResponse" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPermissionResponse_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPermissionListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PermissionListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetPermissionResponse" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPermissionResponse_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get Plan details</summary> /// <param name="planId">Id of the plan to fetch details</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetPlanById(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerPlan>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetPlanById_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get Plan details</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetPlanByIdViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerPlan>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetPlanById_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get Plan details</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerPlan>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerPlan> GetPlanByIdViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetPlanByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Get Plan details</summary> /// <param name="planId">Id of the plan to fetch details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerPlan>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerPlan> GetPlanByIdWithResult(long planId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetPlanByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetPlanByIdWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerPlan>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerPlan> GetPlanByIdWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ServerPlan.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetPlanById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerPlan>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ServerPlan.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetPlanById" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="planId">Id of the plan to fetch details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanById_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get All Plans as Name Id Pairs</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetPlanIds(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IEntityDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/PlanIds" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetPlanIds_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Plans as Name Id Pairs</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IEntityDetails>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IEntityDetails> GetPlanIdsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/PlanIds" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetPlanIdsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetPlanIdsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IEntityDetails>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IEntityDetails> GetPlanIdsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.EntityDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetPlanIds" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanIds_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IEntityDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.EntityDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetPlanIds" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanIds_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// API to fetch list of entities that are applicable for plan association via plan assignment rules. /// </summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetPlanRuleAssociatedEntities(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanRuleApplicableEntitiesList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/Entities" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetPlanRuleAssociatedEntities_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetPlanRuleAssociatedEntities" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanRuleAssociatedEntities_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanRuleApplicableEntitiesList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanRuleApplicableEntitiesList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetPlanRuleAssociatedEntities" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanRuleAssociatedEntities_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Api to fetch plan rules details.</summary> /// <param name="ruleId">Id of the rule to update in Plan</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetPlanRuleDetails(long ruleId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanEntityRuleInfo>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/" + (ruleId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetPlanRuleDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Api to fetch plan rules details.</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetPlanRuleDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanEntityRuleInfo>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/Rule/(?<ruleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/Rule/{ruleId}'"); } // replace URI parameters with values from identity var ruleId = _match.Groups["ruleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/" + ruleId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetPlanRuleDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetPlanRuleDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanRuleDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanEntityRuleInfo>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanEntityRuleInfo.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetPlanRuleDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="ruleId">Id of the rule to update in Plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanRuleDetails_Validate(long ruleId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get excluded workloads from plan rule evaluation framework</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetPlanRuleEntitiesExclude(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanRuleExcludedEntitiesList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/Entities/Exclude" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetPlanRuleEntitiesExclude_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetPlanRuleEntitiesExclude" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanRuleEntitiesExclude_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanRuleExcludedEntitiesList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanRuleExcludedEntitiesList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetPlanRuleEntitiesExclude" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanRuleEntitiesExclude_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Fetch plan rule execution settings</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetPlanRuleSettings(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanRuleExecutionSettings>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onUnauthorized, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/Settings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetPlanRuleSettings_Call (request, onOk,onUnauthorized,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetPlanRuleSettings" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanRuleSettings_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanRuleExecutionSettings>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onUnauthorized, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanRuleExecutionSettings.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onUnauthorized(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetPlanRuleSettings" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanRuleSettings_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Api to fetch plan rules list.</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetPlanRules(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanEntityRuleList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetPlanRules_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetPlanRules" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanRules_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanEntityRuleList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanEntityRuleList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetPlanRules" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanRules_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get Summary of a Plan</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetPlanSummary(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSummaryListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Summary" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetPlanSummary_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get Summary of a Plan</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSummaryListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSummaryListResp> GetPlanSummaryWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Summary" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetPlanSummaryWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetPlanSummaryWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSummaryListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSummaryListResp> GetPlanSummaryWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanSummaryListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetPlanSummary" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanSummary_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSummaryListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanSummaryListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetPlanSummary" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlanSummary_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get eligibility for install job option at different entity level</summary> /// <param name="option">Specify the entity level for which to fetch install jobs options. Accepted values [ 2 = Client, 3 /// = Client Group, 4 = Commcell]</param> /// <param name="clientId">Id of the client or client group for which to fetch install job options</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetPlatformUpgradeOptions(long? option, long? clientId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSetWindowsMssqlPatchingMsg>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/PlatformUpgrade/Options" + "?" + (null == option ? global::System.String.Empty : "option=" + global::System.Uri.EscapeDataString(option.ToString())) + "&" + (null == clientId ? global::System.String.Empty : "clientId=" + global::System.Uri.EscapeDataString(clientId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetPlatformUpgradeOptions_Call (request, onOk,eventListener,sender); } } /// <summary>API to get eligibility for install job option at different entity level</summary> /// <param name="viaIdentity"></param> /// <param name="option">Specify the entity level for which to fetch install jobs options. Accepted values [ 2 = Client, 3 /// = Client Group, 4 = Commcell]</param> /// <param name="clientId">Id of the client or client group for which to fetch install job options</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetPlatformUpgradeOptionsViaIdentity(global::System.String viaIdentity, long? option, long? clientId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSetWindowsMssqlPatchingMsg>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/PlatformUpgrade/Options$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/PlatformUpgrade/Options'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/PlatformUpgrade/Options" + "?" + (null == option ? global::System.String.Empty : "option=" + global::System.Uri.EscapeDataString(option.ToString())) + "&" + (null == clientId ? global::System.String.Empty : "clientId=" + global::System.Uri.EscapeDataString(clientId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetPlatformUpgradeOptions_Call (request, onOk,eventListener,sender); } } /// <summary>API to get eligibility for install job option at different entity level</summary> /// <param name="viaIdentity"></param> /// <param name="option">Specify the entity level for which to fetch install jobs options. Accepted values [ 2 = Client, 3 /// = Client Group, 4 = Commcell]</param> /// <param name="clientId">Id of the client or client group for which to fetch install job options</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSetWindowsMssqlPatchingMsg>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSetWindowsMssqlPatchingMsg> GetPlatformUpgradeOptionsViaIdentityWithResult(global::System.String viaIdentity, long? option, long? clientId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/PlatformUpgrade/Options$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/PlatformUpgrade/Options'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/PlatformUpgrade/Options" + "?" + (null == option ? global::System.String.Empty : "option=" + global::System.Uri.EscapeDataString(option.ToString())) + "&" + (null == clientId ? global::System.String.Empty : "clientId=" + global::System.Uri.EscapeDataString(clientId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetPlatformUpgradeOptionsWithResult_Call (request, eventListener,sender); } } /// <summary>API to get eligibility for install job option at different entity level</summary> /// <param name="option">Specify the entity level for which to fetch install jobs options. Accepted values [ 2 = Client, 3 /// = Client Group, 4 = Commcell]</param> /// <param name="clientId">Id of the client or client group for which to fetch install job options</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSetWindowsMssqlPatchingMsg>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSetWindowsMssqlPatchingMsg> GetPlatformUpgradeOptionsWithResult(long? option, long? clientId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/PlatformUpgrade/Options" + "?" + (null == option ? global::System.String.Empty : "option=" + global::System.Uri.EscapeDataString(option.ToString())) + "&" + (null == clientId ? global::System.String.Empty : "clientId=" + global::System.Uri.EscapeDataString(clientId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetPlatformUpgradeOptionsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetPlatformUpgradeOptionsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSetWindowsMssqlPatchingMsg>" /> that /// will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSetWindowsMssqlPatchingMsg> GetPlatformUpgradeOptionsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetSetWindowsMssqlPatchingMsg.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetPlatformUpgradeOptions" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlatformUpgradeOptions_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSetWindowsMssqlPatchingMsg>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetSetWindowsMssqlPatchingMsg.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetPlatformUpgradeOptions" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="option">Specify the entity level for which to fetch install jobs options. Accepted values [ 2 = Client, 3 /// = Client Group, 4 = Commcell]</param> /// <param name="clientId">Id of the client or client group for which to fetch install job options</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetPlatformUpgradeOptions_Validate(long? option, long? clientId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Retrieve list of projects for the request</summary> /// <param name="requestId">Unique request id</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetProjectsForRequest(long requestId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRmProjectsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request/" + (requestId.ToString()) + "/Projects" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetProjectsForRequest_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Retrieve list of projects for the request</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetProjectsForRequestViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRmProjectsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/RequestManager/Request/(?<requestId>[^/]+)/Projects$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/RequestManager/Request/{requestId}/Projects'"); } // replace URI parameters with values from identity var requestId = _match.Groups["requestId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request/" + requestId + "/Projects" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetProjectsForRequest_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetProjectsForRequest" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetProjectsForRequest_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRmProjectsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RmProjectsList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetProjectsForRequest" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="requestId">Unique request id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetProjectsForRequest_Validate(long requestId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get qualified server list to create a new software cache</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetQualifiedServersForSoftwareCache(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISoftwareCacheDetailListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SoftwareCache/QualifiedServers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetQualifiedServersForSoftwareCache_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetQualifiedServersForSoftwareCache" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetQualifiedServersForSoftwareCache_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISoftwareCacheDetailListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SoftwareCacheDetailListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetQualifiedServersForSoftwareCache" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetQualifiedServersForSoftwareCache_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the details of a recovery entity</summary> /// <param name="recoveryEntityId">Recovery entity Id</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRecoveryEntity(long recoveryEntityId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRecoveryEntity>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryEntity/" + (recoveryEntityId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRecoveryEntity_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Get the details of a recovery entity</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRecoveryEntityViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRecoveryEntity>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/RecoveryEntity/(?<recoveryEntityId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryEntity/{recoveryEntityId}'"); } // replace URI parameters with values from identity var recoveryEntityId = _match.Groups["recoveryEntityId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryEntity/" + recoveryEntityId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRecoveryEntity_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetRecoveryEntity" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRecoveryEntity_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRecoveryEntity>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RecoveryEntity.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetRecoveryEntity" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="recoveryEntityId">Recovery entity Id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRecoveryEntity_Validate(long recoveryEntityId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details for recovery group</summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="getEntityDetails">Get the entity details with recovery group details</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRecoveryGroup(long recoveryGroupId, bool? getEntityDetails, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetRecoveryGroupDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + (recoveryGroupId.ToString()) + "?" + (null == getEntityDetails ? global::System.String.Empty : "getEntityDetails=" + global::System.Uri.EscapeDataString(getEntityDetails.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRecoveryGroup_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details for recovery group</summary> /// <param name="viaIdentity"></param> /// <param name="getEntityDetails">Get the entity details with recovery group details</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRecoveryGroupViaIdentity(global::System.String viaIdentity, bool? getEntityDetails, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetRecoveryGroupDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/RecoveryGroup/(?<recoveryGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryGroup/{recoveryGroupId}'"); } // replace URI parameters with values from identity var recoveryGroupId = _match.Groups["recoveryGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + recoveryGroupId + "?" + (null == getEntityDetails ? global::System.String.Empty : "getEntityDetails=" + global::System.Uri.EscapeDataString(getEntityDetails.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRecoveryGroup_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetRecoveryGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRecoveryGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetRecoveryGroupDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetRecoveryGroupDetailsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetRecoveryGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="getEntityDetails">Get the entity details with recovery group details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRecoveryGroup_Validate(long recoveryGroupId, bool? getEntityDetails, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the list of Recovery groups</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotImplemented">a delegate that is called when the remote service returns 501 (NotImplemented).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRecoveryGroups(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRecoveryGroupListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotImplemented, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroups" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRecoveryGroups_Call (request, onOk,onNotImplemented,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetRecoveryGroups" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotImplemented">a delegate that is called when the remote service returns 501 (NotImplemented).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRecoveryGroups_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRecoveryGroupListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotImplemented, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RecoveryGroupListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotImplemented: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotImplemented(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetRecoveryGroups" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRecoveryGroups_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the list of recovery point stores.</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRecoveryPointStoreList(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRpStoreListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryPointStores" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRecoveryPointStoreList_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetRecoveryPointStoreList" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRecoveryPointStoreList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRpStoreListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RpStoreListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetRecoveryPointStoreList" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRecoveryPointStoreList_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Fetch details about recovery point stores or library details</summary> /// <param name="rpsId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRecoveryPointStores(string rpsId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRecoveryPointStoreDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryPointStore/" + global::System.Uri.EscapeDataString(rpsId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRecoveryPointStores_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Fetch details about recovery point stores or library details</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRecoveryPointStoresViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRecoveryPointStoreDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/RecoveryPointStore/(?<rpsId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/RecoveryPointStore/{rpsId}'"); } // replace URI parameters with values from identity var rpsId = _match.Groups["rpsId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryPointStore/" + rpsId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRecoveryPointStores_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetRecoveryPointStores" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRecoveryPointStores_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRecoveryPointStoreDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RecoveryPointStoreDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetRecoveryPointStores" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="rpsId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRecoveryPointStores_Validate(string rpsId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(rpsId),rpsId); } } /// <summary>To get recovery target details by ID</summary> /// <param name="recoveryTargetId">id of recovery target</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRecoveryTarget(long recoveryTargetId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsN53EymV4RecoverytargetRecoverytargetidGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryTarget/" + (recoveryTargetId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRecoveryTarget_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>To get recovery target details by ID</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRecoveryTargetViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsN53EymV4RecoverytargetRecoverytargetidGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/RecoveryTarget/(?<recoveryTargetId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/RecoveryTarget/{recoveryTargetId}'"); } // replace URI parameters with values from identity var recoveryTargetId = _match.Groups["recoveryTargetId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryTarget/" + recoveryTargetId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRecoveryTarget_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>To get recovery target details by ID</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsN53EymV4RecoverytargetRecoverytargetidGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsN53EymV4RecoverytargetRecoverytargetidGetResponses200ContentApplicationJsonSchema> GetRecoveryTargetViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/RecoveryTarget/(?<recoveryTargetId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/RecoveryTarget/{recoveryTargetId}'"); } // replace URI parameters with values from identity var recoveryTargetId = _match.Groups["recoveryTargetId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryTarget/" + recoveryTargetId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetRecoveryTargetWithResult_Call (request, eventListener,sender); } } /// <summary>To get recovery target details by ID</summary> /// <param name="recoveryTargetId">id of recovery target</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsN53EymV4RecoverytargetRecoverytargetidGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsN53EymV4RecoverytargetRecoverytargetidGetResponses200ContentApplicationJsonSchema> GetRecoveryTargetWithResult(long recoveryTargetId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryTarget/" + (recoveryTargetId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetRecoveryTargetWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetRecoveryTargetWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsN53EymV4RecoverytargetRecoverytargetidGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsN53EymV4RecoverytargetRecoverytargetidGetResponses200ContentApplicationJsonSchema> GetRecoveryTargetWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PathsN53EymV4RecoverytargetRecoverytargetidGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetRecoveryTarget" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRecoveryTarget_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsN53EymV4RecoverytargetRecoverytargetidGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PathsN53EymV4RecoverytargetRecoverytargetidGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetRecoveryTarget" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="recoveryTargetId">id of recovery target</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRecoveryTarget_Validate(long recoveryTargetId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the list of recovery targets</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRecoveryTargets(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetRecoveryTargetListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RecoveryTargets" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRecoveryTargets_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetRecoveryTargets" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRecoveryTargets_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetRecoveryTargetListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetRecoveryTargetListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetRecoveryTargets" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRecoveryTargets_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details of the region</summary> /// <param name="regionId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRegionDetails(long regionId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions/" + (regionId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRegionDetails_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get details of the region</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRegionDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Regions/(?<regionId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Regions/{regionId}'"); } // replace URI parameters with values from identity var regionId = _match.Groups["regionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions/" + regionId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRegionDetails_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get details of the region</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionDetails>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionDetails> GetRegionDetailsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Regions/(?<regionId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Regions/{regionId}'"); } // replace URI parameters with values from identity var regionId = _match.Groups["regionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions/" + regionId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetRegionDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get details of the region</summary> /// <param name="regionId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionDetails>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionDetails> GetRegionDetailsWithResult(long regionId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions/" + (regionId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetRegionDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetRegionDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionDetails>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionDetails> GetRegionDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RegionDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetRegionDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRegionDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RegionDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetRegionDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="regionId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRegionDetails_Validate(long regionId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Fetch region for multiple entity</summary> /// <param name="entityType">Entity Type Enum</param> /// <param name="regionType">Region Type Enum</param> /// <param name="entities">Comma Seprated Entity Ids</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRegionForEntities(string entityType, string regionType, string entities, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEntityRegionResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/entity/region" + "?" + "entityType=" + global::System.Uri.EscapeDataString(entityType) + "&" + (string.IsNullOrEmpty(regionType) ? global::System.String.Empty : "regionType=" + global::System.Uri.EscapeDataString(regionType)) + "&" + "entities=" + global::System.Uri.EscapeDataString(entities) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRegionForEntities_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Fetch region for multiple entity</summary> /// <param name="viaIdentity"></param> /// <param name="entityType">Entity Type Enum</param> /// <param name="regionType">Region Type Enum</param> /// <param name="entities">Comma Seprated Entity Ids</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRegionForEntitiesViaIdentity(global::System.String viaIdentity, string entityType, string regionType, string entities, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEntityRegionResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/entity/region$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/entity/region'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/entity/region" + "?" + "entityType=" + global::System.Uri.EscapeDataString(entityType) + "&" + (string.IsNullOrEmpty(regionType) ? global::System.String.Empty : "regionType=" + global::System.Uri.EscapeDataString(regionType)) + "&" + "entities=" + global::System.Uri.EscapeDataString(entities) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRegionForEntities_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Fetch region for multiple entity</summary> /// <param name="viaIdentity"></param> /// <param name="entityType">Entity Type Enum</param> /// <param name="regionType">Region Type Enum</param> /// <param name="entities">Comma Seprated Entity Ids</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEntityRegionResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEntityRegionResp> GetRegionForEntitiesViaIdentityWithResult(global::System.String viaIdentity, string entityType, string regionType, string entities, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/entity/region$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/entity/region'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/entity/region" + "?" + "entityType=" + global::System.Uri.EscapeDataString(entityType) + "&" + (string.IsNullOrEmpty(regionType) ? global::System.String.Empty : "regionType=" + global::System.Uri.EscapeDataString(regionType)) + "&" + "entities=" + global::System.Uri.EscapeDataString(entities) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetRegionForEntitiesWithResult_Call (request, eventListener,sender); } } /// <summary>Fetch region for multiple entity</summary> /// <param name="entityType">Entity Type Enum</param> /// <param name="regionType">Region Type Enum</param> /// <param name="entities">Comma Seprated Entity Ids</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEntityRegionResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEntityRegionResp> GetRegionForEntitiesWithResult(string entityType, string regionType, string entities, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/entity/region" + "?" + "entityType=" + global::System.Uri.EscapeDataString(entityType) + "&" + (string.IsNullOrEmpty(regionType) ? global::System.String.Empty : "regionType=" + global::System.Uri.EscapeDataString(regionType)) + "&" + "entities=" + global::System.Uri.EscapeDataString(entities) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetRegionForEntitiesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetRegionForEntitiesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEntityRegionResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEntityRegionResp> GetRegionForEntitiesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetEntityRegionResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetRegionForEntities" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRegionForEntities_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetEntityRegionResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetEntityRegionResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetRegionForEntities" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="entityType">Entity Type Enum</param> /// <param name="regionType">Region Type Enum</param> /// <param name="entities">Comma Seprated Entity Ids</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRegionForEntities_Validate(string entityType, string regionType, string entities, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(entityType),entityType); await eventListener.AssertNotNull(nameof(regionType),regionType); await eventListener.AssertNotNull(nameof(entities),entities); } } /// <summary>Api to fetch region details for an entity.</summary> /// <param name="entityType">Type of the entity</param> /// <param name="entityId">Unique id for the entity</param> /// <param name="calculate">Flag for Enable/Disable Region Calculation</param> /// <param name="entityRegionType">Region Type Enum</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRegionForEntity(string entityType, long entityId, bool? calculate, string entityRegionType, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameDisplayName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/entity/" + global::System.Uri.EscapeDataString(entityType) + "/" + (entityId.ToString()) + "/region" + "?" + (null == calculate ? global::System.String.Empty : "calculate=" + global::System.Uri.EscapeDataString(calculate.ToString())) + "&" + (string.IsNullOrEmpty(entityRegionType) ? global::System.String.Empty : "entityRegionType=" + global::System.Uri.EscapeDataString(entityRegionType)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRegionForEntity_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Api to fetch region details for an entity.</summary> /// <param name="viaIdentity"></param> /// <param name="calculate">Flag for Enable/Disable Region Calculation</param> /// <param name="entityRegionType">Region Type Enum</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRegionForEntityViaIdentity(global::System.String viaIdentity, bool? calculate, string entityRegionType, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameDisplayName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/entity/(?<entityType>[^/]+)/(?<entityId>[^/]+)/region$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/entity/{entityType}/{entityId}/region'"); } // replace URI parameters with values from identity var entityType = _match.Groups["entityType"].Value; var entityId = _match.Groups["entityId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/entity/" + entityType + "/" + entityId + "/region" + "?" + (null == calculate ? global::System.String.Empty : "calculate=" + global::System.Uri.EscapeDataString(calculate.ToString())) + "&" + (string.IsNullOrEmpty(entityRegionType) ? global::System.String.Empty : "entityRegionType=" + global::System.Uri.EscapeDataString(entityRegionType)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRegionForEntity_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Api to fetch region details for an entity.</summary> /// <param name="viaIdentity"></param> /// <param name="calculate">Flag for Enable/Disable Region Calculation</param> /// <param name="entityRegionType">Region Type Enum</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameDisplayName>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameDisplayName> GetRegionForEntityViaIdentityWithResult(global::System.String viaIdentity, bool? calculate, string entityRegionType, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/entity/(?<entityType>[^/]+)/(?<entityId>[^/]+)/region$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/entity/{entityType}/{entityId}/region'"); } // replace URI parameters with values from identity var entityType = _match.Groups["entityType"].Value; var entityId = _match.Groups["entityId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/entity/" + entityType + "/" + entityId + "/region" + "?" + (null == calculate ? global::System.String.Empty : "calculate=" + global::System.Uri.EscapeDataString(calculate.ToString())) + "&" + (string.IsNullOrEmpty(entityRegionType) ? global::System.String.Empty : "entityRegionType=" + global::System.Uri.EscapeDataString(entityRegionType)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetRegionForEntityWithResult_Call (request, eventListener,sender); } } /// <summary>Api to fetch region details for an entity.</summary> /// <param name="entityType">Type of the entity</param> /// <param name="entityId">Unique id for the entity</param> /// <param name="calculate">Flag for Enable/Disable Region Calculation</param> /// <param name="entityRegionType">Region Type Enum</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameDisplayName>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameDisplayName> GetRegionForEntityWithResult(string entityType, long entityId, bool? calculate, string entityRegionType, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/entity/" + global::System.Uri.EscapeDataString(entityType) + "/" + (entityId.ToString()) + "/region" + "?" + (null == calculate ? global::System.String.Empty : "calculate=" + global::System.Uri.EscapeDataString(calculate.ToString())) + "&" + (string.IsNullOrEmpty(entityRegionType) ? global::System.String.Empty : "entityRegionType=" + global::System.Uri.EscapeDataString(entityRegionType)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetRegionForEntityWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetRegionForEntityWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameDisplayName>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameDisplayName> GetRegionForEntityWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdNameDisplayName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetRegionForEntity" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRegionForEntity_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdNameDisplayName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdNameDisplayName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetRegionForEntity" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="entityType">Type of the entity</param> /// <param name="entityId">Unique id for the entity</param> /// <param name="calculate">Flag for Enable/Disable Region Calculation</param> /// <param name="entityRegionType">Region Type Enum</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRegionForEntity_Validate(string entityType, long entityId, bool? calculate, string entityRegionType, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(entityType),entityType); await eventListener.AssertNotNull(nameof(entityRegionType),entityRegionType); } } /// <summary>Get list of regions</summary> /// <param name="type">Region type to be filtered</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRegions(string type, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionsListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions" + "?" + (string.IsNullOrEmpty(type) ? global::System.String.Empty : "type=" + global::System.Uri.EscapeDataString(type)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRegions_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of regions</summary> /// <param name="viaIdentity"></param> /// <param name="type">Region type to be filtered</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRegionsViaIdentity(global::System.String viaIdentity, string type, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionsListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Regions$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Regions'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions" + "?" + (string.IsNullOrEmpty(type) ? global::System.String.Empty : "type=" + global::System.Uri.EscapeDataString(type)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRegions_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of regions</summary> /// <param name="viaIdentity"></param> /// <param name="type">Region type to be filtered</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionsListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionsListResp> GetRegionsViaIdentityWithResult(global::System.String viaIdentity, string type, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Regions$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Regions'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions" + "?" + (string.IsNullOrEmpty(type) ? global::System.String.Empty : "type=" + global::System.Uri.EscapeDataString(type)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetRegionsWithResult_Call (request, eventListener,sender); } } /// <summary>Get list of regions</summary> /// <param name="type">Region type to be filtered</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionsListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionsListResp> GetRegionsWithResult(string type, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions" + "?" + (string.IsNullOrEmpty(type) ? global::System.String.Empty : "type=" + global::System.Uri.EscapeDataString(type)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetRegionsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetRegionsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionsListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionsListResp> GetRegionsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RegionsListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetRegions" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRegions_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRegionsListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RegionsListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetRegions" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="type">Region type to be filtered</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRegions_Validate(string type, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(type),type); } } /// <summary>Get all replication groups</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetReplicationGroups(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IReplicationGroupListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ReplicationGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetReplicationGroups_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get all replication groups</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IReplicationGroupListResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IReplicationGroupListResp> GetReplicationGroupsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ReplicationGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetReplicationGroupsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetReplicationGroupsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IReplicationGroupListResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IReplicationGroupListResp> GetReplicationGroupsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ReplicationGroupListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetReplicationGroups" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetReplicationGroups_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IReplicationGroupListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ReplicationGroupListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetReplicationGroups" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetReplicationGroups_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get Continuous Replication Pair Details</summary> /// <param name="pairId"></param> /// <param name="additionalProperties">To get extra meta data details for the api</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetReplicationMonitorPairId(long pairId, bool? additionalProperties, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IReplicationMonitorDetail>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ReplicationMonitor/" + (pairId.ToString()) + "?" + (null == additionalProperties ? global::System.String.Empty : "additionalProperties=" + global::System.Uri.EscapeDataString(additionalProperties.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetReplicationMonitorPairId_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Get Continuous Replication Pair Details</summary> /// <param name="viaIdentity"></param> /// <param name="additionalProperties">To get extra meta data details for the api</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetReplicationMonitorPairIdViaIdentity(global::System.String viaIdentity, bool? additionalProperties, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IReplicationMonitorDetail>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ReplicationMonitor/(?<pairId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ReplicationMonitor/{pairId}'"); } // replace URI parameters with values from identity var pairId = _match.Groups["pairId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ReplicationMonitor/" + pairId + "?" + (null == additionalProperties ? global::System.String.Empty : "additionalProperties=" + global::System.Uri.EscapeDataString(additionalProperties.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetReplicationMonitorPairId_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetReplicationMonitorPairId" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetReplicationMonitorPairId_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IReplicationMonitorDetail>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ReplicationMonitorDetail.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetReplicationMonitorPairId" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="pairId"></param> /// <param name="additionalProperties">To get extra meta data details for the api</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetReplicationMonitorPairId_Validate(long pairId, bool? additionalProperties, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Retrieve details of an existing request</summary> /// <param name="requestId">Unique identifier for the request</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRequestDetails(long requestId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRmRequestDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request/" + (requestId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRequestDetails_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Retrieve details of an existing request</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRequestDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRmRequestDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/RequestManager/Request/(?<requestId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/RequestManager/Request/{requestId}'"); } // replace URI parameters with values from identity var requestId = _match.Groups["requestId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request/" + requestId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRequestDetails_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetRequestDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRequestDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRmRequestDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RmRequestDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetRequestDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="requestId">Unique identifier for the request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRequestDetails_Validate(long requestId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get All Resource Pools</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetResourcePools(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IResourcePoolListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ResourcePool" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetResourcePools_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Resource Pools</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IResourcePoolListResponse>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IResourcePoolListResponse> GetResourcePoolsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ResourcePool" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetResourcePoolsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetResourcePoolsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IResourcePoolListResponse>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IResourcePoolListResponse> GetResourcePoolsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ResourcePoolListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetResourcePools" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetResourcePools_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IResourcePoolListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ResourcePoolListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetResourcePools" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetResourcePools_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get a details of the role whose role id has been provided</summary> /// <param name="roleId">Role Id</param> /// <param name="showInheritedAssociation">Shows inherited security associations</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRoleDetails(long roleId, bool? showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRole>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role/" + (roleId.ToString()) + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRoleDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get a details of the role whose role id has been provided</summary> /// <param name="viaIdentity"></param> /// <param name="showInheritedAssociation">Shows inherited security associations</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRoleDetailsViaIdentity(global::System.String viaIdentity, bool? showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRole>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Role/(?<roleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Role/{roleId}'"); } // replace URI parameters with values from identity var roleId = _match.Groups["roleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role/" + roleId + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRoleDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get a details of the role whose role id has been provided</summary> /// <param name="viaIdentity"></param> /// <param name="showInheritedAssociation">Shows inherited security associations</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRole>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRole> GetRoleDetailsViaIdentityWithResult(global::System.String viaIdentity, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Role/(?<roleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Role/{roleId}'"); } // replace URI parameters with values from identity var roleId = _match.Groups["roleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role/" + roleId + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetRoleDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get a details of the role whose role id has been provided</summary> /// <param name="roleId">Role Id</param> /// <param name="showInheritedAssociation">Shows inherited security associations</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRole>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRole> GetRoleDetailsWithResult(long roleId, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role/" + (roleId.ToString()) + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetRoleDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetRoleDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRole>" /> that will be complete when handling /// of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRole> GetRoleDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Role.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetRoleDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRoleDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRole>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Role.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetRoleDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="roleId">Role Id</param> /// <param name="showInheritedAssociation">Shows inherited security associations</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRoleDetails_Validate(long roleId, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get jobs running to a storage pool.</summary> /// <param name="storagePoolId">Id of storage pool</param> /// <param name="jobType">Type of job</param> /// <param name="ignoreSuspendedJobs">To include/exlude suspended jobs in the response</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRunningJobsForStoragePool(long storagePoolId, string jobType, bool? ignoreSuspendedJobs, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetRunningJobsIdList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + (storagePoolId.ToString()) + "/runningJobs" + "?" + (string.IsNullOrEmpty(jobType) ? global::System.String.Empty : "jobType=" + global::System.Uri.EscapeDataString(jobType)) + "&" + (null == ignoreSuspendedJobs ? global::System.String.Empty : "ignoreSuspendedJobs=" + global::System.Uri.EscapeDataString(ignoreSuspendedJobs.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRunningJobsForStoragePool_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>API to get jobs running to a storage pool.</summary> /// <param name="viaIdentity"></param> /// <param name="jobType">Type of job</param> /// <param name="ignoreSuspendedJobs">To include/exlude suspended jobs in the response</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetRunningJobsForStoragePoolViaIdentity(global::System.String viaIdentity, string jobType, bool? ignoreSuspendedJobs, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetRunningJobsIdList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StoragePool/(?<storagePoolId>[^/]+)/runningJobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StoragePool/{storagePoolId}/runningJobs'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StoragePool/" + storagePoolId + "/runningJobs" + "?" + (string.IsNullOrEmpty(jobType) ? global::System.String.Empty : "jobType=" + global::System.Uri.EscapeDataString(jobType)) + "&" + (null == ignoreSuspendedJobs ? global::System.String.Empty : "ignoreSuspendedJobs=" + global::System.Uri.EscapeDataString(ignoreSuspendedJobs.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetRunningJobsForStoragePool_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetRunningJobsForStoragePool" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRunningJobsForStoragePool_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetRunningJobsIdList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetRunningJobsIdList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetRunningJobsForStoragePool" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="storagePoolId">Id of storage pool</param> /// <param name="jobType">Type of job</param> /// <param name="ignoreSuspendedJobs">To include/exlude suspended jobs in the response</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetRunningJobsForStoragePool_Validate(long storagePoolId, string jobType, bool? ignoreSuspendedJobs, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(jobType),jobType); } } /// <summary>Get the S3 Access Key for the logged in user on email</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetS3AccessKey(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/User/S3AccessKey" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetS3AccessKey_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Get the S3 Access Key for the logged in user on email</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> GetS3AccessKeyWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/User/S3AccessKey" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetS3AccessKeyWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetS3AccessKeyWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> GetS3AccessKeyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetS3AccessKey" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetS3AccessKey_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetS3AccessKey" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetS3AccessKey_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Fetch the details of the clone of the given ID</summary> /// <param name="id">ID of the bucket</param> /// <param name="cloneId">ID of the cloned bucket</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetS3BucketCloneDetails(long id, long cloneId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCvfss3BucketCloneDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + (id.ToString()) + "/Clone/" + (cloneId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetS3BucketCloneDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Fetch the details of the clone of the given ID</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetS3BucketCloneDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCvfss3BucketCloneDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CVFS/S3Bucket/(?<id>[^/]+)/Clone/(?<cloneId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CVFS/S3Bucket/{id}/Clone/{cloneId}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; var cloneId = _match.Groups["cloneId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + id + "/Clone/" + cloneId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetS3BucketCloneDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetS3BucketCloneDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetS3BucketCloneDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetCvfss3BucketCloneDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetCvfss3BucketCloneDetailsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetS3BucketCloneDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="id">ID of the bucket</param> /// <param name="cloneId">ID of the cloned bucket</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetS3BucketCloneDetails_Validate(long id, long cloneId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Gets details of SAML app based on SAML app name</summary> /// <param name="name"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSamlApp(string name, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISaml>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SAML/" + global::System.Uri.EscapeDataString(name) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSamlApp_Call (request, onOk,eventListener,sender); } } /// <summary>Gets details of SAML app based on SAML app name</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSamlAppViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISaml>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/SAML/(?<name>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/SAML/{name}'"); } // replace URI parameters with values from identity var name = _match.Groups["name"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SAML/" + name ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSamlApp_Call (request, onOk,eventListener,sender); } } /// <summary>Gets details of SAML app based on SAML app name</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISaml>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISaml> GetSamlAppViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/SAML/(?<name>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/SAML/{name}'"); } // replace URI parameters with values from identity var name = _match.Groups["name"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SAML/" + name ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSamlAppWithResult_Call (request, eventListener,sender); } } /// <summary>Gets details of SAML app based on SAML app name</summary> /// <param name="name"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISaml>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISaml> GetSamlAppWithResult(string name, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SAML/" + global::System.Uri.EscapeDataString(name) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSamlAppWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSamlAppWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISaml>" /> that will be complete when handling /// of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISaml> GetSamlAppWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Saml.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetSamlApp" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSamlApp_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISaml>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Saml.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSamlApp" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="name"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSamlApp_Validate(string name, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(name),name); } } /// <summary>API to fetch DC plan associated to server group</summary> /// <param name="serverGroupId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetServerGroupDcPlan(long serverGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/DCPlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetServerGroupDcPlan_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>API to fetch DC plan associated to server group</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetServerGroupDcPlanViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/DCPlan$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/DCPlan'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/DCPlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetServerGroupDcPlan_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetServerGroupDcPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServerGroupDcPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetServerGroupDcPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="serverGroupId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServerGroupDcPlan_Validate(long serverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details of a serverGroup based on id</summary> /// <param name="serverGroupId">Id of the serverGroupId whose details have to be fetched</param> /// <param name="mode"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetServerGroupIdDetails(long serverGroupId, string mode, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerGroup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetServerGroupIdDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a serverGroup based on id</summary> /// <param name="viaIdentity"></param> /// <param name="mode"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetServerGroupIdDetailsViaIdentity(global::System.String viaIdentity, string mode, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerGroup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetServerGroupIdDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a serverGroup based on id</summary> /// <param name="viaIdentity"></param> /// <param name="mode"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerGroup>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerGroup> GetServerGroupIdDetailsViaIdentityWithResult(global::System.String viaIdentity, string mode, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetServerGroupIdDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get details of a serverGroup based on id</summary> /// <param name="serverGroupId">Id of the serverGroupId whose details have to be fetched</param> /// <param name="mode"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerGroup>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerGroup> GetServerGroupIdDetailsWithResult(long serverGroupId, string mode, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetServerGroupIdDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetServerGroupIdDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerGroup>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerGroup> GetServerGroupIdDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ServerGroup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetServerGroupIdDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServerGroupIdDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServerGroup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ServerGroup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetServerGroupIdDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="serverGroupId">Id of the serverGroupId whose details have to be fetched</param> /// <param name="mode"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServerGroupIdDetails_Validate(long serverGroupId, string mode, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(mode),mode); } } /// <summary>Get All Server Groups</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetServerGroups(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetServerGroupsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetServerGroups_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Server Groups</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetServerGroupsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetServerGroupsResp> GetServerGroupsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetServerGroupsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetServerGroupsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetServerGroupsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetServerGroupsResp> GetServerGroupsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetServerGroupsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetServerGroups" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServerGroups_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetServerGroupsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetServerGroupsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetServerGroups" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServerGroups_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to fetch schedules responsible for server plan RPO</summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetServerPlanRpo(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSchedules>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/RPO" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetServerPlanRpo_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>API to fetch schedules responsible for server plan RPO</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetServerPlanRpoViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSchedules>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/RPO$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/RPO'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/RPO" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetServerPlanRpo_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetServerPlanRpo" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServerPlanRpo_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSchedules>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanSchedules.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetServerPlanRpo" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServerPlanRpo_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>This end point returns the list of servers</summary> /// <param name="showOnlyInfrastructureMachines">Returns only infrastructure machines if value is 1 if 0, it returns all servers, /// default value is 1</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetServers(long? showOnlyInfrastructureMachines, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServersListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Servers" + "?" + (null == showOnlyInfrastructureMachines ? global::System.String.Empty : "showOnlyInfrastructureMachines=" + global::System.Uri.EscapeDataString(showOnlyInfrastructureMachines.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetServers_Call (request, onOk,eventListener,sender); } } /// <summary>API to get list of servers with no packages for a company</summary> /// <param name="companyId">Id of the Company whose servers(with no packages) have to be fetched</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetServersForCompany(long companyId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetPseudoClientsForCompanyResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/Servers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetServersForCompany_Call (request, onOk,eventListener,sender); } } /// <summary>API to get list of servers with no packages for a company</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetServersForCompanyViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetPseudoClientsForCompanyResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/Servers$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/Servers'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/Servers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetServersForCompany_Call (request, onOk,eventListener,sender); } } /// <summary>API to get list of servers with no packages for a company</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetPseudoClientsForCompanyResp>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetPseudoClientsForCompanyResp> GetServersForCompanyViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/Servers$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/Servers'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/Servers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetServersForCompanyWithResult_Call (request, eventListener,sender); } } /// <summary>API to get list of servers with no packages for a company</summary> /// <param name="companyId">Id of the Company whose servers(with no packages) have to be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetPseudoClientsForCompanyResp>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetPseudoClientsForCompanyResp> GetServersForCompanyWithResult(long companyId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/Servers" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetServersForCompanyWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetServersForCompanyWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetPseudoClientsForCompanyResp>" /> that /// will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetPseudoClientsForCompanyResp> GetServersForCompanyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetPseudoClientsForCompanyResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetServersForCompany" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServersForCompany_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetPseudoClientsForCompanyResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetPseudoClientsForCompanyResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetServersForCompany" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="companyId">Id of the Company whose servers(with no packages) have to be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServersForCompany_Validate(long companyId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>This end point returns the list of servers</summary> /// <param name="viaIdentity"></param> /// <param name="showOnlyInfrastructureMachines">Returns only infrastructure machines if value is 1 if 0, it returns all servers, /// default value is 1</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetServersViaIdentity(global::System.String viaIdentity, long? showOnlyInfrastructureMachines, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServersListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Servers$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Servers'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Servers" + "?" + (null == showOnlyInfrastructureMachines ? global::System.String.Empty : "showOnlyInfrastructureMachines=" + global::System.Uri.EscapeDataString(showOnlyInfrastructureMachines.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetServers_Call (request, onOk,eventListener,sender); } } /// <summary>This end point returns the list of servers</summary> /// <param name="viaIdentity"></param> /// <param name="showOnlyInfrastructureMachines">Returns only infrastructure machines if value is 1 if 0, it returns all servers, /// default value is 1</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServersListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServersListResp> GetServersViaIdentityWithResult(global::System.String viaIdentity, long? showOnlyInfrastructureMachines, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Servers$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Servers'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Servers" + "?" + (null == showOnlyInfrastructureMachines ? global::System.String.Empty : "showOnlyInfrastructureMachines=" + global::System.Uri.EscapeDataString(showOnlyInfrastructureMachines.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetServersWithResult_Call (request, eventListener,sender); } } /// <summary>This end point returns the list of servers</summary> /// <param name="showOnlyInfrastructureMachines">Returns only infrastructure machines if value is 1 if 0, it returns all servers, /// default value is 1</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServersListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServersListResp> GetServersWithResult(long? showOnlyInfrastructureMachines, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Servers" + "?" + (null == showOnlyInfrastructureMachines ? global::System.String.Empty : "showOnlyInfrastructureMachines=" + global::System.Uri.EscapeDataString(showOnlyInfrastructureMachines.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetServersWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetServersWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServersListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServersListResp> GetServersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ServersListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetServers" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IServersListResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ServersListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetServers" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="showOnlyInfrastructureMachines">Returns only infrastructure machines if value is 1 if 0, it returns all servers, /// default value is 1</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServers_Validate(long? showOnlyInfrastructureMachines, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Returns a list of Service Commcells</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetServiceCommcells(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths9Ld6GxV4ServicecommcellsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServiceCommcells" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetServiceCommcells_Call (request, onOk,onServiceUnavailable,eventListener,sender); } } /// <summary>Returns a list of Service Commcells</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths9Ld6GxV4ServicecommcellsGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths9Ld6GxV4ServicecommcellsGetResponses200ContentApplicationJsonSchema> GetServiceCommcellsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServiceCommcells" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetServiceCommcellsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetServiceCommcellsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths9Ld6GxV4ServicecommcellsGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths9Ld6GxV4ServicecommcellsGetResponses200ContentApplicationJsonSchema> GetServiceCommcellsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths9Ld6GxV4ServicecommcellsGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetServiceCommcells" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServiceCommcells_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths9Ld6GxV4ServicecommcellsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths9Ld6GxV4ServicecommcellsGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetServiceCommcells" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServiceCommcells_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Gets the Service mesh and it's related properties configured for this Commcell</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetServiceMeshDetails(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetServiceMeshDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServiceMesh" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetServiceMeshDetails_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetServiceMeshDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServiceMeshDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetServiceMeshDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetServiceMeshDetailsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetServiceMeshDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetServiceMeshDetails_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get list of Office 365 Sharepoint Online apps</summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSharepointClient(long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/SharePoint" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSharepointClient_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of Office 365 Sharepoint Online apps</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSharepointClientViaIdentity(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/SharePoint$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/SharePoint'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/SharePoint" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSharepointClient_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of Office 365 Sharepoint Online apps</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp> GetSharepointClientViaIdentityWithResult(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/SharePoint$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/SharePoint'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/SharePoint" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSharepointClientWithResult_Call (request, eventListener,sender); } } /// <summary>Get list of Office 365 Sharepoint Online apps</summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp> GetSharepointClientWithResult(long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/SharePoint" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSharepointClientWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSharepointClientWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp> GetSharepointClientWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365ClientsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetSharepointClient" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSharepointClient_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365ClientsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSharepointClient" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSharepointClient_Validate(long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(sort),sort); await eventListener.AssertNotNull(nameof(searchKey),searchKey); } } /// <summary>Get Office 365 Sharepoint Online Content</summary> /// <param name="appId">Commvault sharepoint app id</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSharepointContent(long appId, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SharepointContentResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/SharePoint/" + (appId.ToString()) + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSharepointContent_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Sharepoint Online Content</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSharepointContentViaIdentity(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SharepointContentResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/SharePoint/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/SharePoint/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/SharePoint/" + appId + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSharepointContent_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Sharepoint Online Content</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SharepointContentResp>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SharepointContentResp> GetSharepointContentViaIdentityWithResult(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/SharePoint/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/SharePoint/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/SharePoint/" + appId + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSharepointContentWithResult_Call (request, eventListener,sender); } } /// <summary>Get Office 365 Sharepoint Online Content</summary> /// <param name="appId">Commvault sharepoint app id</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SharepointContentResp>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SharepointContentResp> GetSharepointContentWithResult(long appId, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/SharePoint/" + (appId.ToString()) + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSharepointContentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSharepointContentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SharepointContentResp>" /> that /// will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SharepointContentResp> GetSharepointContentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365SharepointContentResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetSharepointContent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSharepointContent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SharepointContentResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365SharepointContentResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSharepointContent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="appId">Commvault sharepoint app id</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSharepointContent_Validate(long appId, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(sort),sort); await eventListener.AssertNotNull(nameof(searchKey),searchKey); } } /// <summary>Get Office 365 Sharepoint Online Sites</summary> /// <param name="appId">Commvault sharepoint app id</param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSharepointSites(long appId, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SitesResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Sharepoint/" + (appId.ToString()) + "/Sites" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSharepointSites_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Sharepoint Online Sites</summary> /// <param name="viaIdentity"></param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSharepointSitesViaIdentity(global::System.String viaIdentity, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SitesResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Sharepoint/(?<appId>[^/]+)/Sites$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Sharepoint/{appId}/Sites'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Sharepoint/" + appId + "/Sites" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSharepointSites_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Sharepoint Online Sites</summary> /// <param name="viaIdentity"></param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SitesResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SitesResp> GetSharepointSitesViaIdentityWithResult(global::System.String viaIdentity, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Sharepoint/(?<appId>[^/]+)/Sites$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Sharepoint/{appId}/Sites'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Sharepoint/" + appId + "/Sites" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSharepointSitesWithResult_Call (request, eventListener,sender); } } /// <summary>Get Office 365 Sharepoint Online Sites</summary> /// <param name="appId">Commvault sharepoint app id</param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SitesResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SitesResp> GetSharepointSitesWithResult(long appId, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Sharepoint/" + (appId.ToString()) + "/Sites" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSharepointSitesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSharepointSitesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SitesResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SitesResp> GetSharepointSitesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365SitesResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetSharepointSites" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSharepointSites_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365SitesResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365SitesResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSharepointSites" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="appId">Commvault sharepoint app id</param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSharepointSites_Validate(long appId, string propertyLevel, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(propertyLevel),propertyLevel); await eventListener.AssertNotNull(nameof(sort),sort); await eventListener.AssertNotNull(nameof(searchKey),searchKey); } } /// <summary>Api to fetch summary of a plan.</summary> /// <param name="planId">Id of the plan to get summary of</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSinglePlanSummary(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISinglePlanSummary>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/Plan/Summary/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSinglePlanSummary_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Api to fetch summary of a plan.</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSinglePlanSummaryViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISinglePlanSummary>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/v4/Plan/Summary/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/v4/Plan/Summary/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/Plan/Summary/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSinglePlanSummary_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSinglePlanSummary" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSinglePlanSummary_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISinglePlanSummary>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SinglePlanSummary.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSinglePlanSummary" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the plan to get summary of</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSinglePlanSummary_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the list of slot for given library.</summary> /// <param name="libraryId">Id of Library</param> /// <param name="slotType">Filter slot list to given SlotTypes</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSlotListForLibrary(long libraryId, string slotType, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSlotListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Library/" + (libraryId.ToString()) + "/Slot" + "?" + "slotType=" + global::System.Uri.EscapeDataString(slotType) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSlotListForLibrary_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Get the list of slot for given library.</summary> /// <param name="viaIdentity"></param> /// <param name="slotType">Filter slot list to given SlotTypes</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSlotListForLibraryViaIdentity(global::System.String viaIdentity, string slotType, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSlotListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Library/(?<libraryId>[^/]+)/Slot$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Library/{libraryId}/Slot'"); } // replace URI parameters with values from identity var libraryId = _match.Groups["libraryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Library/" + libraryId + "/Slot" + "?" + "slotType=" + global::System.Uri.EscapeDataString(slotType) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSlotListForLibrary_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSlotListForLibrary" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSlotListForLibrary_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSlotListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetSlotListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSlotListForLibrary" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="libraryId">Id of Library</param> /// <param name="slotType">Filter slot list to given SlotTypes</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSlotListForLibrary_Validate(long libraryId, string slotType, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(slotType),slotType); } } /// <summary>API to get all IntelliSnap enabled Clients</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSnapClients(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapClientsList>>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Client/Snap/Enabled" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSnapClients_Call (request, onOk,eventListener,sender); } } /// <summary>API to get all IntelliSnap enabled Clients</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapClientsList>>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapClientsList>> GetSnapClientsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Client/Snap/Enabled" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSnapClientsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSnapClientsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapClientsList>>" /// /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapClientsList>> GetSnapClientsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => If( Commvault.Powershell.Runtime.Json.JsonArray.Parse(body.Result) as Commvault.Powershell.Runtime.Json.JsonArray, out var __y) ? new global::System.Func<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapClientsList>>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__y, (__x)=>(Commvault.Powershell.Models.IIntelliSnapClientsList) (Commvault.Powershell.Models.IntelliSnapClientsList.FromJson(__x) )) ))() : null); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetSnapClients" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSnapClients_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapClientsList>>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => If( Commvault.Powershell.Runtime.Json.JsonArray.Parse(body.Result) as Commvault.Powershell.Runtime.Json.JsonArray, out var __y) ? new global::System.Func<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapClientsList>>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__y, (__x)=>(Commvault.Powershell.Models.IIntelliSnapClientsList) (Commvault.Powershell.Models.IntelliSnapClientsList.FromJson(__x) )) ))() : null)); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSnapClients" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSnapClients_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>get snap config for vendor.</summary> /// <param name="vendorId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSnapConfig(long vendorId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSnapConfig>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Vendors/" + (vendorId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSnapConfig_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>get snap config for vendor.</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSnapConfigViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSnapConfig>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Vendors/(?<vendorId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Vendors/{vendorId}'"); } // replace URI parameters with values from identity var vendorId = _match.Groups["vendorId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Vendors/" + vendorId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSnapConfig_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>get snap config for vendor.</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSnapConfig>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSnapConfig> GetSnapConfigViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Vendors/(?<vendorId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Vendors/{vendorId}'"); } // replace URI parameters with values from identity var vendorId = _match.Groups["vendorId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Vendors/" + vendorId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSnapConfigWithResult_Call (request, eventListener,sender); } } /// <summary>get snap config for vendor.</summary> /// <param name="vendorId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSnapConfig>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSnapConfig> GetSnapConfigWithResult(long vendorId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Vendors/" + (vendorId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSnapConfigWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSnapConfigWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSnapConfig>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSnapConfig> GetSnapConfigWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetSnapConfig.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetSnapConfig" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSnapConfig_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSnapConfig>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetSnapConfig.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSnapConfig" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="vendorId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSnapConfig_Validate(long vendorId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get all IntelliSnap enabled subclients for particular client</summary> /// <param name="clientId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSnapSubclients(long clientId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapSubclients>>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Client/" + (clientId.ToString()) + "/subclient/Snap/Enabled" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSnapSubclients_Call (request, onOk,eventListener,sender); } } /// <summary>API to get all IntelliSnap enabled subclients for particular client</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSnapSubclientsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapSubclients>>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Client/(?<clientId>[^/]+)/subclient/Snap/Enabled$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Client/{clientId}/subclient/Snap/Enabled'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Client/" + clientId + "/subclient/Snap/Enabled" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSnapSubclients_Call (request, onOk,eventListener,sender); } } /// <summary>API to get all IntelliSnap enabled subclients for particular client</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapSubclients>>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapSubclients>> GetSnapSubclientsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Client/(?<clientId>[^/]+)/subclient/Snap/Enabled$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Client/{clientId}/subclient/Snap/Enabled'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Client/" + clientId + "/subclient/Snap/Enabled" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSnapSubclientsWithResult_Call (request, eventListener,sender); } } /// <summary>API to get all IntelliSnap enabled subclients for particular client</summary> /// <param name="clientId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapSubclients>>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapSubclients>> GetSnapSubclientsWithResult(long clientId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Client/" + (clientId.ToString()) + "/subclient/Snap/Enabled" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSnapSubclientsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSnapSubclientsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapSubclients>>" /// /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapSubclients>> GetSnapSubclientsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => If( Commvault.Powershell.Runtime.Json.JsonArray.Parse(body.Result) as Commvault.Powershell.Runtime.Json.JsonArray, out var __y) ? new global::System.Func<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapSubclients>>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__y, (__x)=>(Commvault.Powershell.Models.IIntelliSnapSubclients) (Commvault.Powershell.Models.IntelliSnapSubclients.FromJson(__x) )) ))() : null); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetSnapSubclients" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSnapSubclients_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapSubclients>>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => If( Commvault.Powershell.Runtime.Json.JsonArray.Parse(body.Result) as Commvault.Powershell.Runtime.Json.JsonArray, out var __y) ? new global::System.Func<System.Collections.Generic.List<Commvault.Powershell.Models.IIntelliSnapSubclients>>(()=> global::System.Linq.Enumerable.ToList(global::System.Linq.Enumerable.Select(__y, (__x)=>(Commvault.Powershell.Models.IIntelliSnapSubclients) (Commvault.Powershell.Models.IntelliSnapSubclients.FromJson(__x) )) ))() : null)); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSnapSubclients" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="clientId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSnapSubclients_Validate(long clientId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get list of SNMP hosts for alert notification</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSnmPhosts(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsZz45HxV4SnmpGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Snmp" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSnmPhosts_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get list of SNMP hosts for alert notification</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsZz45HxV4SnmpGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsZz45HxV4SnmpGetResponses200ContentApplicationJsonSchema> GetSnmPhostsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Snmp" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSnmPhostsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSnmPhostsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsZz45HxV4SnmpGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsZz45HxV4SnmpGetResponses200ContentApplicationJsonSchema> GetSnmPhostsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PathsZz45HxV4SnmpGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetSnmPhosts" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSnmPhosts_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsZz45HxV4SnmpGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PathsZz45HxV4SnmpGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSnmPhosts" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSnmPhosts_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get software cache details for specific server</summary> /// <param name="clientId">Software cache client id</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSoftwareCacheDetailsForServer(long clientId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISoftwareCacheDetail>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SoftwareCache/" + (clientId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSoftwareCacheDetailsForServer_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Get software cache details for specific server</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSoftwareCacheDetailsForServerViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISoftwareCacheDetail>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/SoftwareCache/(?<clientId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/SoftwareCache/{clientId}'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SoftwareCache/" + clientId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSoftwareCacheDetailsForServer_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSoftwareCacheDetailsForServer" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSoftwareCacheDetailsForServer_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISoftwareCacheDetail>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SoftwareCacheDetail.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSoftwareCacheDetailsForServer" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="clientId">Software cache client id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSoftwareCacheDetailsForServer_Validate(long clientId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get all software caches details</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSoftwareCachesDetails(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISoftwareCacheDetailListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SoftwareCache" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSoftwareCachesDetails_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSoftwareCachesDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSoftwareCachesDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISoftwareCacheDetailListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SoftwareCacheDetailListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSoftwareCachesDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSoftwareCachesDetails_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// API to fetch applicable workload solutions for the user like File Server, Virtualization or Database /// </summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSolutionsId(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISolutionsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Solutions" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSolutionsId_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSolutionsId" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSolutionsId_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISolutionsList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SolutionsList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSolutionsId" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSolutionsId_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Gives a list of eligible source copies for CommServe DR storage policy</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSourceCopiesForDrBackup(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DRBackup/BackupDestination/SourceCopy/Eligible" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSourceCopiesForDrBackup_Call (request, onOk,eventListener,sender); } } /// <summary>Gives a list of eligible source copies for CommServe DR storage policy</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies> GetSourceCopiesForDrBackupWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DRBackup/BackupDestination/SourceCopy/Eligible" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSourceCopiesForDrBackupWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetSourceCopiesForDrBackupWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies> GetSourceCopiesForDrBackupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanSourceCopies.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetSourceCopiesForDrBackup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSourceCopiesForDrBackup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanSourceCopies.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSourceCopiesForDrBackup" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSourceCopiesForDrBackup_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Gives a list of eligible source copies for given region id</summary> /// <param name="planId">Id of plan</param> /// <param name="regionId">Region Id against which we want to check eligible source copies. Skip if no region present.</param> /// <param name="forSnapCopy">Get list of source copy eligible for snap copy in given region.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSourceCopiesForGivenServerPlanRegion(long planId, long? regionId, bool? forSnapCopy, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/ServerPlan/" + (planId.ToString()) + "/BackupDestination/SourceCopy/Eligible" + "?" + (null == regionId ? global::System.String.Empty : "regionId=" + global::System.Uri.EscapeDataString(regionId.ToString())) + "&" + (null == forSnapCopy ? global::System.String.Empty : "forSnapCopy=" + global::System.Uri.EscapeDataString(forSnapCopy.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSourceCopiesForGivenServerPlanRegion_Call (request, onOk,eventListener,sender); } } /// <summary>Gives a list of eligible source copies for given region id</summary> /// <param name="viaIdentity"></param> /// <param name="regionId">Region Id against which we want to check eligible source copies. Skip if no region present.</param> /// <param name="forSnapCopy">Get list of source copy eligible for snap copy in given region.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSourceCopiesForGivenServerPlanRegionViaIdentity(global::System.String viaIdentity, long? regionId, bool? forSnapCopy, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/ServerPlan/(?<planId>[^/]+)/BackupDestination/SourceCopy/Eligible$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/ServerPlan/{planId}/BackupDestination/SourceCopy/Eligible'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/ServerPlan/" + planId + "/BackupDestination/SourceCopy/Eligible" + "?" + (null == regionId ? global::System.String.Empty : "regionId=" + global::System.Uri.EscapeDataString(regionId.ToString())) + "&" + (null == forSnapCopy ? global::System.String.Empty : "forSnapCopy=" + global::System.Uri.EscapeDataString(forSnapCopy.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSourceCopiesForGivenServerPlanRegion_Call (request, onOk,eventListener,sender); } } /// <summary>Gives a list of eligible source copies for given region id</summary> /// <param name="viaIdentity"></param> /// <param name="regionId">Region Id against which we want to check eligible source copies. Skip if no region present.</param> /// <param name="forSnapCopy">Get list of source copy eligible for snap copy in given region.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies> GetSourceCopiesForGivenServerPlanRegionViaIdentityWithResult(global::System.String viaIdentity, long? regionId, bool? forSnapCopy, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/ServerPlan/(?<planId>[^/]+)/BackupDestination/SourceCopy/Eligible$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/ServerPlan/{planId}/BackupDestination/SourceCopy/Eligible'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/ServerPlan/" + planId + "/BackupDestination/SourceCopy/Eligible" + "?" + (null == regionId ? global::System.String.Empty : "regionId=" + global::System.Uri.EscapeDataString(regionId.ToString())) + "&" + (null == forSnapCopy ? global::System.String.Empty : "forSnapCopy=" + global::System.Uri.EscapeDataString(forSnapCopy.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSourceCopiesForGivenServerPlanRegionWithResult_Call (request, eventListener,sender); } } /// <summary>Gives a list of eligible source copies for given region id</summary> /// <param name="planId">Id of plan</param> /// <param name="regionId">Region Id against which we want to check eligible source copies. Skip if no region present.</param> /// <param name="forSnapCopy">Get list of source copy eligible for snap copy in given region.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies> GetSourceCopiesForGivenServerPlanRegionWithResult(long planId, long? regionId, bool? forSnapCopy, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/ServerPlan/" + (planId.ToString()) + "/BackupDestination/SourceCopy/Eligible" + "?" + (null == regionId ? global::System.String.Empty : "regionId=" + global::System.Uri.EscapeDataString(regionId.ToString())) + "&" + (null == forSnapCopy ? global::System.String.Empty : "forSnapCopy=" + global::System.Uri.EscapeDataString(forSnapCopy.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSourceCopiesForGivenServerPlanRegionWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetSourceCopiesForGivenServerPlanRegionWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies> GetSourceCopiesForGivenServerPlanRegionWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanSourceCopies.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "GetSourceCopiesForGivenServerPlanRegion" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSourceCopiesForGivenServerPlanRegion_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanSourceCopies>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanSourceCopies.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSourceCopiesForGivenServerPlanRegion" /> method. Call this like the actual call, but /// you will get validation events back. /// </summary> /// <param name="planId">Id of plan</param> /// <param name="regionId">Region Id against which we want to check eligible source copies. Skip if no region present.</param> /// <param name="forSnapCopy">Get list of source copy eligible for snap copy in given region.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSourceCopiesForGivenServerPlanRegion_Validate(long planId, long? regionId, bool? forSnapCopy, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to fetch information of Spare Groups of a particular type for a Storage</summary> /// <param name="libraryId">Library ID of the Tape Storage</param> /// <param name="spareGroupType">Get all spare groups of given SpareGroupType</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSpareGroupDetails(long libraryId, string spareGroupType, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSpareGroupListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + (libraryId.ToString()) + "/SpareGroups" + "?" + "SpareGroupType=" + global::System.Uri.EscapeDataString(spareGroupType) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSpareGroupDetails_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>API to fetch information of Spare Groups of a particular type for a Storage</summary> /// <param name="viaIdentity"></param> /// <param name="spareGroupType">Get all spare groups of given SpareGroupType</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSpareGroupDetailsViaIdentity(global::System.String viaIdentity, string spareGroupType, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSpareGroupListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Tape/(?<libraryId>[^/]+)/SpareGroups$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Tape/{libraryId}/SpareGroups'"); } // replace URI parameters with values from identity var libraryId = _match.Groups["libraryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + libraryId + "/SpareGroups" + "?" + "SpareGroupType=" + global::System.Uri.EscapeDataString(spareGroupType) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSpareGroupDetails_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSpareGroupDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSpareGroupDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSpareGroupListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetSpareGroupListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSpareGroupDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="libraryId">Library ID of the Tape Storage</param> /// <param name="spareGroupType">Get all spare groups of given SpareGroupType</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSpareGroupDetails_Validate(long libraryId, string spareGroupType, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(spareGroupType),spareGroupType); } } /// <summary>API to fetch properties of a Spare Group</summary> /// <param name="spareGroupId">Id of the Spare group whose properties need to be fetched. spareGroupId can be fetched from /// GET V4/Storage/Tape/{libraryId}/MediaType</param> /// <param name="libraryId">Library ID of the Tape Storage</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSpareGroupProperties(long spareGroupId, long libraryId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSpareGroupProperties>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + (libraryId.ToString()) + "/SpareGroup/" + (spareGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSpareGroupProperties_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>API to fetch properties of a Spare Group</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSpareGroupPropertiesViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSpareGroupProperties>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Tape/(?<libraryId>[^/]+)/SpareGroup/(?<spareGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Tape/{libraryId}/SpareGroup/{spareGroupId}'"); } // replace URI parameters with values from identity var spareGroupId = _match.Groups["spareGroupId"].Value; var libraryId = _match.Groups["libraryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + libraryId + "/SpareGroup/" + spareGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSpareGroupProperties_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSpareGroupProperties" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSpareGroupProperties_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSpareGroupProperties>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetSpareGroupProperties.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSpareGroupProperties" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="spareGroupId">Id of the Spare group whose properties need to be fetched. spareGroupId can be fetched from /// GET V4/Storage/Tape/{libraryId}/MediaType</param> /// <param name="libraryId">Library ID of the Tape Storage</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSpareGroupProperties_Validate(long spareGroupId, long libraryId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get associated copies and plan which are utilizing this storage.</summary> /// <param name="storagePoolId">Id of the storage pool whose associated copies have to be fetched</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetStorageAssociatedCopies(long storagePoolId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageAssociatedCopies>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/" + (storagePoolId.ToString()) + "/associatedCopies" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetStorageAssociatedCopies_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Get associated copies and plan which are utilizing this storage.</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetStorageAssociatedCopiesViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageAssociatedCopies>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/(?<storagePoolId>[^/]+)/associatedCopies$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/{storagePoolId}/associatedCopies'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/" + storagePoolId + "/associatedCopies" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetStorageAssociatedCopies_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Get associated copies and plan which are utilizing this storage.</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageAssociatedCopies>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageAssociatedCopies> GetStorageAssociatedCopiesViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/(?<storagePoolId>[^/]+)/associatedCopies$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/{storagePoolId}/associatedCopies'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/" + storagePoolId + "/associatedCopies" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetStorageAssociatedCopiesWithResult_Call (request, eventListener,sender); } } /// <summary>Get associated copies and plan which are utilizing this storage.</summary> /// <param name="storagePoolId">Id of the storage pool whose associated copies have to be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageAssociatedCopies>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageAssociatedCopies> GetStorageAssociatedCopiesWithResult(long storagePoolId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/" + (storagePoolId.ToString()) + "/associatedCopies" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetStorageAssociatedCopiesWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetStorageAssociatedCopiesWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageAssociatedCopies>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageAssociatedCopies> GetStorageAssociatedCopiesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.StorageAssociatedCopies.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetStorageAssociatedCopies" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetStorageAssociatedCopies_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IStorageAssociatedCopies>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.StorageAssociatedCopies.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetStorageAssociatedCopies" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="storagePoolId">Id of the storage pool whose associated copies have to be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetStorageAssociatedCopies_Validate(long storagePoolId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to get all arrays at Subclient Level</summary> /// <param name="clientId"></param> /// <param name="subclientId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSubclientLvlArrays(long clientId, long subclientId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Client/" + (clientId.ToString()) + "/Subclient/" + (subclientId.ToString()) + "/Arrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSubclientLvlArrays_Call (request, onOk,eventListener,sender); } } /// <summary>API to get all arrays at Subclient Level</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSubclientLvlArraysViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Client/(?<clientId>[^/]+)/Subclient/(?<subclientId>[^/]+)/Arrays$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Client/{clientId}/Subclient/{subclientId}/Arrays'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; var subclientId = _match.Groups["subclientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Client/" + clientId + "/Subclient/" + subclientId + "/Arrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSubclientLvlArrays_Call (request, onOk,eventListener,sender); } } /// <summary>API to get all arrays at Subclient Level</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp> GetSubclientLvlArraysViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Client/(?<clientId>[^/]+)/Subclient/(?<subclientId>[^/]+)/Arrays$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Client/{clientId}/Subclient/{subclientId}/Arrays'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; var subclientId = _match.Groups["subclientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Client/" + clientId + "/Subclient/" + subclientId + "/Arrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSubclientLvlArraysWithResult_Call (request, eventListener,sender); } } /// <summary>API to get all arrays at Subclient Level</summary> /// <param name="clientId"></param> /// <param name="subclientId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp> GetSubclientLvlArraysWithResult(long clientId, long subclientId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Client/" + (clientId.ToString()) + "/Subclient/" + (subclientId.ToString()) + "/Arrays" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSubclientLvlArraysWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSubclientLvlArraysWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp> GetSubclientLvlArraysWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetArraysResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetSubclientLvlArrays" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSubclientLvlArrays_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetArraysResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetArraysResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSubclientLvlArrays" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="clientId"></param> /// <param name="subclientId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSubclientLvlArrays_Validate(long clientId, long subclientId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to fetch Snap configs for Storage Arrays at subclient level</summary> /// <param name="arrayId"></param> /// <param name="subclientId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSubclientSnapConfigs(long arrayId, long subclientId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Subclient/" + (subclientId.ToString()) + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSubclientSnapConfigs_Call (request, onOk,eventListener,sender); } } /// <summary>API to fetch Snap configs for Storage Arrays at subclient level</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSubclientSnapConfigsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Subclient/(?<subclientId>[^/]+)/Snap/Configs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Subclient/{subclientId}/Snap/Configs'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; var subclientId = _match.Groups["subclientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Subclient/" + subclientId + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSubclientSnapConfigs_Call (request, onOk,eventListener,sender); } } /// <summary>API to fetch Snap configs for Storage Arrays at subclient level</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp> GetSubclientSnapConfigsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Subclient/(?<subclientId>[^/]+)/Snap/Configs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Subclient/{subclientId}/Snap/Configs'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; var subclientId = _match.Groups["subclientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Subclient/" + subclientId + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSubclientSnapConfigsWithResult_Call (request, eventListener,sender); } } /// <summary>API to fetch Snap configs for Storage Arrays at subclient level</summary> /// <param name="arrayId"></param> /// <param name="subclientId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp> GetSubclientSnapConfigsWithResult(long arrayId, long subclientId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Subclient/" + (subclientId.ToString()) + "/Snap/Configs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSubclientSnapConfigsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSubclientSnapConfigsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp> GetSubclientSnapConfigsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapConfigOverrideResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetSubclientSnapConfigs" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSubclientSnapConfigs_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapConfigOverrideResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapConfigOverrideResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSubclientSnapConfigs" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="arrayId"></param> /// <param name="subclientId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSubclientSnapConfigs_Validate(long arrayId, long subclientId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get subclients for requested snapEngineId for requested planId and copyId.</summary> /// <param name="planId">plan Id</param> /// <param name="snapEngineId">Snap Engine Id</param> /// <param name="copyId">Copy Id</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSubclientsForReplication(long planId, long snapEngineId, long? copyId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSubclientForSnapEngine>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Snaps/snapEngine/" + (snapEngineId.ToString()) + "/Plan/" + (planId.ToString()) + "/Subclients" + "?" + (null == copyId ? global::System.String.Empty : "copyId=" + global::System.Uri.EscapeDataString(copyId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSubclientsForReplication_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Get subclients for requested snapEngineId for requested planId and copyId.</summary> /// <param name="viaIdentity"></param> /// <param name="copyId">Copy Id</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSubclientsForReplicationViaIdentity(global::System.String viaIdentity, long? copyId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSubclientForSnapEngine>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Snaps/snapEngine/(?<snapEngineId>[^/]+)/Plan/(?<planId>[^/]+)/Subclients$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Snaps/snapEngine/{snapEngineId}/Plan/{planId}/Subclients'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var snapEngineId = _match.Groups["snapEngineId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Snaps/snapEngine/" + snapEngineId + "/Plan/" + planId + "/Subclients" + "?" + (null == copyId ? global::System.String.Empty : "copyId=" + global::System.Uri.EscapeDataString(copyId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSubclientsForReplication_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSubclientsForReplication" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSubclientsForReplication_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSubclientForSnapEngine>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetSubclientForSnapEngine.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSubclientsForReplication" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="planId">plan Id</param> /// <param name="snapEngineId">Snap Engine Id</param> /// <param name="copyId">Copy Id</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSubclientsForReplication_Validate(long planId, long snapEngineId, long? copyId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get subclients configured with a particular snap engine</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSubclientsForSnapEngine(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSubclientForSnapEngine>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Snaps/Subclients" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSubclientsForSnapEngine_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSubclientsForSnapEngine" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSubclientsForSnapEngine_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetSubclientForSnapEngine>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetSubclientForSnapEngine.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSubclientsForSnapEngine" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSubclientsForSnapEngine_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>This endpoint returns the details of a syslog server.</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetSyslogStatus(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISyslogStatus>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/syslogServer" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetSyslogStatus_Call (request, onOk,onServiceUnavailable,eventListener,sender); } } /// <summary>This endpoint returns the details of a syslog server.</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISyslogStatus>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISyslogStatus> GetSyslogStatusWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/syslogServer" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetSyslogStatusWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetSyslogStatusWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISyslogStatus>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISyslogStatus> GetSyslogStatusWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SyslogStatus.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetSyslogStatus" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSyslogStatus_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISyslogStatus>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SyslogStatus.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetSyslogStatus" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetSyslogStatus_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// Returns list of tags for the logged in user's default entity tag set along with count of associated entities /// </summary> /// <param name="tagId">Id of the tag whose associated entities details needs to be returned</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTagAssociatedEntities(long? tagId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITagAssociatedEntitiesResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Tags/AssociatedEntities" + "?" + (null == tagId ? global::System.String.Empty : "tagId=" + global::System.Uri.EscapeDataString(tagId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTagAssociatedEntities_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary> /// Returns list of tags for the logged in user's default entity tag set along with count of associated entities /// </summary> /// <param name="viaIdentity"></param> /// <param name="tagId">Id of the tag whose associated entities details needs to be returned</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTagAssociatedEntitiesViaIdentity(global::System.String viaIdentity, long? tagId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITagAssociatedEntitiesResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Tags/AssociatedEntities$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Tags/AssociatedEntities'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Tags/AssociatedEntities" + "?" + (null == tagId ? global::System.String.Empty : "tagId=" + global::System.Uri.EscapeDataString(tagId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTagAssociatedEntities_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetTagAssociatedEntities" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTagAssociatedEntities_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITagAssociatedEntitiesResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.TagAssociatedEntitiesResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetTagAssociatedEntities" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="tagId">Id of the tag whose associated entities details needs to be returned</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTagAssociatedEntities_Validate(long? tagId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Gives list of values for given tagId</summary> /// <param name="tagId">Id of the tag name whose value is requested</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTagValuesForTagId(long tagId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITagValueResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Tags/" + (tagId.ToString()) + "/Values" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTagValuesForTagId_Call (request, onOk,onBadRequest,onServiceUnavailable,eventListener,sender); } } /// <summary>Gives list of values for given tagId</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTagValuesForTagIdViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITagValueResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Tags/(?<tagId>[^/]+)/Values$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Tags/{tagId}/Values'"); } // replace URI parameters with values from identity var tagId = _match.Groups["tagId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Tags/" + tagId + "/Values" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTagValuesForTagId_Call (request, onOk,onBadRequest,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetTagValuesForTagId" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTagValuesForTagId_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITagValueResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.TagValueResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetTagValuesForTagId" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="tagId">Id of the tag name whose value is requested</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTagValuesForTagId_Validate(long tagId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get list of Office 365 Teams apps</summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTeamsClient(long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTeamsClient_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of Office 365 Teams apps</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTeamsClientViaIdentity(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Teams$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Teams'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTeamsClient_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of Office 365 Teams apps</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp> GetTeamsClientViaIdentityWithResult(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Teams$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Teams'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetTeamsClientWithResult_Call (request, eventListener,sender); } } /// <summary>Get list of Office 365 Teams apps</summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp> GetTeamsClientWithResult(long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetTeamsClientWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetTeamsClientWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp> GetTeamsClientWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365ClientsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetTeamsClient" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTeamsClient_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365ClientsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365ClientsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetTeamsClient" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTeamsClient_Validate(long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(sort),sort); await eventListener.AssertNotNull(nameof(searchKey),searchKey); } } /// <summary>Get Office 365 Teams Content</summary> /// <param name="appId">Commvault teams app id</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTeamsContent(long appId, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsContentResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams/" + (appId.ToString()) + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTeamsContent_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Teams Content</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTeamsContentViaIdentity(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsContentResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Teams/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Teams/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams/" + appId + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTeamsContent_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Teams Content</summary> /// <param name="viaIdentity"></param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsContentResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsContentResp> GetTeamsContentViaIdentityWithResult(global::System.String viaIdentity, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Teams/(?<appId>[^/]+)/Content$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Teams/{appId}/Content'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams/" + appId + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetTeamsContentWithResult_Call (request, eventListener,sender); } } /// <summary>Get Office 365 Teams Content</summary> /// <param name="appId">Commvault teams app id</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsContentResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsContentResp> GetTeamsContentWithResult(long appId, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams/" + (appId.ToString()) + "/Content" + "?" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetTeamsContentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetTeamsContentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsContentResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsContentResp> GetTeamsContentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365TeamsContentResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetTeamsContent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTeamsContent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsContentResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365TeamsContentResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetTeamsContent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="appId">Commvault teams app id</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTeamsContent_Validate(long appId, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(sort),sort); await eventListener.AssertNotNull(nameof(searchKey),searchKey); } } /// <summary>Get Office 365 Teams List</summary> /// <param name="appId">Commvault teams app id</param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="onlyTeams">Set this optional parameter value 1 to only send teams list, otherwise 0.</param> /// <param name="onlyUsers">Set this optional parameter value 1 to only send teams users list, otherwise 0.</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTeamsList(long appId, string propertyLevel, long? onlyTeams, long? onlyUsers, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams/" + (appId.ToString()) + "/Teams" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == onlyTeams ? global::System.String.Empty : "onlyTeams=" + global::System.Uri.EscapeDataString(onlyTeams.ToString())) + "&" + (null == onlyUsers ? global::System.String.Empty : "onlyUsers=" + global::System.Uri.EscapeDataString(onlyUsers.ToString())) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTeamsList_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Teams List</summary> /// <param name="viaIdentity"></param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="onlyTeams">Set this optional parameter value 1 to only send teams list, otherwise 0.</param> /// <param name="onlyUsers">Set this optional parameter value 1 to only send teams users list, otherwise 0.</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTeamsListViaIdentity(global::System.String viaIdentity, string propertyLevel, long? onlyTeams, long? onlyUsers, long? pageNumber, long? pageSize, string sort, string searchKey, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Teams/(?<appId>[^/]+)/Teams$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Teams/{appId}/Teams'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams/" + appId + "/Teams" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == onlyTeams ? global::System.String.Empty : "onlyTeams=" + global::System.Uri.EscapeDataString(onlyTeams.ToString())) + "&" + (null == onlyUsers ? global::System.String.Empty : "onlyUsers=" + global::System.Uri.EscapeDataString(onlyUsers.ToString())) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTeamsList_Call (request, onOk,eventListener,sender); } } /// <summary>Get Office 365 Teams List</summary> /// <param name="viaIdentity"></param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="onlyTeams">Set this optional parameter value 1 to only send teams list, otherwise 0.</param> /// <param name="onlyUsers">Set this optional parameter value 1 to only send teams users list, otherwise 0.</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsResp> GetTeamsListViaIdentityWithResult(global::System.String viaIdentity, string propertyLevel, long? onlyTeams, long? onlyUsers, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Office365/Teams/(?<appId>[^/]+)/Teams$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Office365/Teams/{appId}/Teams'"); } // replace URI parameters with values from identity var appId = _match.Groups["appId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams/" + appId + "/Teams" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == onlyTeams ? global::System.String.Empty : "onlyTeams=" + global::System.Uri.EscapeDataString(onlyTeams.ToString())) + "&" + (null == onlyUsers ? global::System.String.Empty : "onlyUsers=" + global::System.Uri.EscapeDataString(onlyUsers.ToString())) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetTeamsListWithResult_Call (request, eventListener,sender); } } /// <summary>Get Office 365 Teams List</summary> /// <param name="appId">Commvault teams app id</param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="onlyTeams">Set this optional parameter value 1 to only send teams list, otherwise 0.</param> /// <param name="onlyUsers">Set this optional parameter value 1 to only send teams users list, otherwise 0.</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsResp> GetTeamsListWithResult(long appId, string propertyLevel, long? onlyTeams, long? onlyUsers, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Office365/Teams/" + (appId.ToString()) + "/Teams" + "?" + (string.IsNullOrEmpty(propertyLevel) ? global::System.String.Empty : "propertyLevel=" + global::System.Uri.EscapeDataString(propertyLevel)) + "&" + (null == onlyTeams ? global::System.String.Empty : "onlyTeams=" + global::System.Uri.EscapeDataString(onlyTeams.ToString())) + "&" + (null == onlyUsers ? global::System.String.Empty : "onlyUsers=" + global::System.Uri.EscapeDataString(onlyUsers.ToString())) + "&" + (null == pageNumber ? global::System.String.Empty : "pageNumber=" + global::System.Uri.EscapeDataString(pageNumber.ToString())) + "&" + (null == pageSize ? global::System.String.Empty : "pageSize=" + global::System.Uri.EscapeDataString(pageSize.ToString())) + "&" + (string.IsNullOrEmpty(sort) ? global::System.String.Empty : "sort=" + global::System.Uri.EscapeDataString(sort)) + "&" + (string.IsNullOrEmpty(searchKey) ? global::System.String.Empty : "searchKey=" + global::System.Uri.EscapeDataString(searchKey)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetTeamsListWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetTeamsListWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsResp> GetTeamsListWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365TeamsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetTeamsList" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTeamsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IOffice365TeamsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Office365TeamsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetTeamsList" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="appId">Commvault teams app id</param> /// <param name="propertyLevel">Optional parameter. Set it to BasicProperties or AllProperties</param> /// <param name="onlyTeams">Set this optional parameter value 1 to only send teams list, otherwise 0.</param> /// <param name="onlyUsers">Set this optional parameter value 1 to only send teams users list, otherwise 0.</param> /// <param name="pageNumber"></param> /// <param name="pageSize"></param> /// <param name="sort"></param> /// <param name="searchKey"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTeamsList_Validate(long appId, string propertyLevel, long? onlyTeams, long? onlyUsers, long? pageNumber, long? pageSize, string sort, string searchKey, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(propertyLevel),propertyLevel); await eventListener.AssertNotNull(nameof(sort),sort); await eventListener.AssertNotNull(nameof(searchKey),searchKey); } } /// <summary>View all TestFailover Machines of the replication pair using replicationPairId</summary> /// <param name="replicationPairId">Replication pair id of the Pair</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTestFailoverMachines(long replicationPairId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1Im1UjeV4ReplicationmonitorReplicationpairidTestfailovermachinesGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ReplicationMonitor/" + (replicationPairId.ToString()) + "/testFailoverMachines" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTestFailoverMachines_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>API to get test failover machines for failover group</summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTestFailoverMachinesFailoverGroup(long failoverGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsVh225Av4FailovergroupsFailovergroupidTestfailovermachinesGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + (failoverGroupId.ToString()) + "/TestFailoverMachines" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTestFailoverMachinesFailoverGroup_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>API to get test failover machines for failover group</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTestFailoverMachinesFailoverGroupViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsVh225Av4FailovergroupsFailovergroupidTestfailovermachinesGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/FailoverGroups/(?<failoverGroupId>[^/]+)/TestFailoverMachines$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/FailoverGroups/{failoverGroupId}/TestFailoverMachines'"); } // replace URI parameters with values from identity var failoverGroupId = _match.Groups["failoverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + failoverGroupId + "/TestFailoverMachines" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTestFailoverMachinesFailoverGroup_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetTestFailoverMachinesFailoverGroup" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTestFailoverMachinesFailoverGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsVh225Av4FailovergroupsFailovergroupidTestfailovermachinesGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PathsVh225Av4FailovergroupsFailovergroupidTestfailovermachinesGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetTestFailoverMachinesFailoverGroup" /> method. Call this like the actual call, but /// you will get validation events back. /// </summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTestFailoverMachinesFailoverGroup_Validate(long failoverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>View all TestFailover Machines of the replication pair using replicationPairId</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTestFailoverMachinesViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1Im1UjeV4ReplicationmonitorReplicationpairidTestfailovermachinesGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ReplicationMonitor/(?<replicationPairId>[^/]+)/testFailoverMachines$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ReplicationMonitor/{replicationPairId}/testFailoverMachines'"); } // replace URI parameters with values from identity var replicationPairId = _match.Groups["replicationPairId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ReplicationMonitor/" + replicationPairId + "/testFailoverMachines" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTestFailoverMachines_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetTestFailoverMachines" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTestFailoverMachines_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1Im1UjeV4ReplicationmonitorReplicationpairidTestfailovermachinesGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths1Im1UjeV4ReplicationmonitorReplicationpairidTestfailovermachinesGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetTestFailoverMachines" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="replicationPairId">Replication pair id of the Pair</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTestFailoverMachines_Validate(long replicationPairId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details of triggered alert</summary> /// <param name="id"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTriggeredAlertDetails(long id, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITriggeredAlertsDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + (id.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTriggeredAlertDetails_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get details of triggered alert</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetTriggeredAlertDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITriggeredAlertsDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/TriggeredAlerts/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/TriggeredAlerts/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + id ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetTriggeredAlertDetails_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Get details of triggered alert</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITriggeredAlertsDetails>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITriggeredAlertsDetails> GetTriggeredAlertDetailsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/TriggeredAlerts/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/TriggeredAlerts/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + id ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetTriggeredAlertDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get details of triggered alert</summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITriggeredAlertsDetails>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITriggeredAlertsDetails> GetTriggeredAlertDetailsWithResult(long id, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + (id.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetTriggeredAlertDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetTriggeredAlertDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITriggeredAlertsDetails>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITriggeredAlertsDetails> GetTriggeredAlertDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.TriggeredAlertsDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetTriggeredAlertDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTriggeredAlertDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITriggeredAlertsDetails>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.TriggeredAlertsDetails.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetTriggeredAlertDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetTriggeredAlertDetails_Validate(long id, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details of a User based on id</summary> /// <param name="userId">Id of the User whose details have to be fetched</param> /// <param name="mode"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetUserDetails(long userId, string mode, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUser>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + (userId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetUserDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a User based on id</summary> /// <param name="viaIdentity"></param> /// <param name="mode"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetUserDetailsViaIdentity(global::System.String viaIdentity, string mode, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUser>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/user/(?<userId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/user/{userId}'"); } // replace URI parameters with values from identity var userId = _match.Groups["userId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + userId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetUserDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a User based on id</summary> /// <param name="viaIdentity"></param> /// <param name="mode"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUser>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUser> GetUserDetailsViaIdentityWithResult(global::System.String viaIdentity, string mode, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/user/(?<userId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/user/{userId}'"); } // replace URI parameters with values from identity var userId = _match.Groups["userId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + userId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetUserDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get details of a User based on id</summary> /// <param name="userId">Id of the User whose details have to be fetched</param> /// <param name="mode"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUser>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUser> GetUserDetailsWithResult(long userId, string mode, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + (userId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetUserDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetUserDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUser>" /> that will be complete when handling /// of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUser> GetUserDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.User.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetUserDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetUserDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUser>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.User.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetUserDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="userId">Id of the User whose details have to be fetched</param> /// <param name="mode"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetUserDetails_Validate(long userId, string mode, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(mode),mode); } } /// <summary>Get details of a user-group based on id</summary> /// <param name="userGroupId">Id of the user-group whose details have to be fetched</param> /// <param name="mode"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetUserGroupDetails(long userGroupId, string mode, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup/" + (userGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetUserGroupDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a user-group based on id</summary> /// <param name="viaIdentity"></param> /// <param name="mode"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetUserGroupDetailsViaIdentity(global::System.String viaIdentity, string mode, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/UserGroup/(?<userGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/UserGroup/{userGroupId}'"); } // replace URI parameters with values from identity var userGroupId = _match.Groups["userGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup/" + userGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetUserGroupDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a user-group based on id</summary> /// <param name="viaIdentity"></param> /// <param name="mode"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroup>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroup> GetUserGroupDetailsViaIdentityWithResult(global::System.String viaIdentity, string mode, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/UserGroup/(?<userGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/UserGroup/{userGroupId}'"); } // replace URI parameters with values from identity var userGroupId = _match.Groups["userGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup/" + userGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetUserGroupDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get details of a user-group based on id</summary> /// <param name="userGroupId">Id of the user-group whose details have to be fetched</param> /// <param name="mode"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroup>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroup> GetUserGroupDetailsWithResult(long userGroupId, string mode, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup/" + (userGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetUserGroupDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetUserGroupDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroup>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroup> GetUserGroupDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.UserGroup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetUserGroupDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetUserGroupDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.UserGroup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetUserGroupDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="userGroupId">Id of the user-group whose details have to be fetched</param> /// <param name="mode"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetUserGroupDetails_Validate(long userGroupId, string mode, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(mode),mode); } } /// <summary>Get a list of existing user groups.</summary> /// <param name="mode"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetUserGroups(string mode, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroupListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetUserGroups_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get a list of existing user groups.</summary> /// <param name="viaIdentity"></param> /// <param name="mode"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetUserGroupsViaIdentity(global::System.String viaIdentity, string mode, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroupListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/UserGroup$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/UserGroup'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetUserGroups_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get a list of existing user groups.</summary> /// <param name="viaIdentity"></param> /// <param name="mode"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroupListResponse>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroupListResponse> GetUserGroupsViaIdentityWithResult(global::System.String viaIdentity, string mode, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/UserGroup$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/UserGroup'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetUserGroupsWithResult_Call (request, eventListener,sender); } } /// <summary>Get a list of existing user groups.</summary> /// <param name="mode"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroupListResponse>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroupListResponse> GetUserGroupsWithResult(string mode, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // add headers parameters if (null != mode) { request.Headers.Add("mode",mode); } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetUserGroupsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetUserGroupsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroupListResponse>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroupListResponse> GetUserGroupsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.UserGroupListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetUserGroups" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetUserGroups_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserGroupListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.UserGroupListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetUserGroups" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="mode"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetUserGroups_Validate(string mode, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(mode),mode); } } /// <summary>Get the S3 Access Key for the given user on their email</summary> /// <param name="id">ID of the user</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetUserS3AccessKey(long id, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/User/" + (id.ToString()) + "/S3AccessKey" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetUserS3AccessKey_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Get the S3 Access Key for the given user on their email</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetUserS3AccessKeyViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/User/(?<id>[^/]+)/S3AccessKey$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/User/{id}/S3AccessKey'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/User/" + id + "/S3AccessKey" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetUserS3AccessKey_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Get the S3 Access Key for the given user on their email</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> GetUserS3AccessKeyViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/User/(?<id>[^/]+)/S3AccessKey$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/User/{id}/S3AccessKey'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/User/" + id + "/S3AccessKey" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetUserS3AccessKeyWithResult_Call (request, eventListener,sender); } } /// <summary>Get the S3 Access Key for the given user on their email</summary> /// <param name="id">ID of the user</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> GetUserS3AccessKeyWithResult(long id, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/User/" + (id.ToString()) + "/S3AccessKey" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetUserS3AccessKeyWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetUserS3AccessKeyWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> GetUserS3AccessKeyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetUserS3AccessKey" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetUserS3AccessKey_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetUserS3AccessKey" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id">ID of the user</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetUserS3AccessKey_Validate(long id, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to fetch authentication methods of an existing user</summary> /// <param name="userId">Id of the User whose authentication method details have to be fetched</param> /// <param name="fetchAvailableMethodsOnly">Set as true to fetch the list of available authentication methods for the user</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetUserauthenticationMethods(long userId, bool? fetchAvailableMethodsOnly, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserAuthenticationMethods>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + (userId.ToString()) + "/authenticationMethods" + "?" + (null == fetchAvailableMethodsOnly ? global::System.String.Empty : "fetchAvailableMethodsOnly=" + global::System.Uri.EscapeDataString(fetchAvailableMethodsOnly.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetUserauthenticationMethods_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to fetch authentication methods of an existing user</summary> /// <param name="viaIdentity"></param> /// <param name="fetchAvailableMethodsOnly">Set as true to fetch the list of available authentication methods for the user</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetUserauthenticationMethodsViaIdentity(global::System.String viaIdentity, bool? fetchAvailableMethodsOnly, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserAuthenticationMethods>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/user/(?<userId>[^/]+)/authenticationMethods$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/user/{userId}/authenticationMethods'"); } // replace URI parameters with values from identity var userId = _match.Groups["userId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + userId + "/authenticationMethods" + "?" + (null == fetchAvailableMethodsOnly ? global::System.String.Empty : "fetchAvailableMethodsOnly=" + global::System.Uri.EscapeDataString(fetchAvailableMethodsOnly.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetUserauthenticationMethods_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to fetch authentication methods of an existing user</summary> /// <param name="viaIdentity"></param> /// <param name="fetchAvailableMethodsOnly">Set as true to fetch the list of available authentication methods for the user</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserAuthenticationMethods>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserAuthenticationMethods> GetUserauthenticationMethodsViaIdentityWithResult(global::System.String viaIdentity, bool? fetchAvailableMethodsOnly, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/user/(?<userId>[^/]+)/authenticationMethods$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/user/{userId}/authenticationMethods'"); } // replace URI parameters with values from identity var userId = _match.Groups["userId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + userId + "/authenticationMethods" + "?" + (null == fetchAvailableMethodsOnly ? global::System.String.Empty : "fetchAvailableMethodsOnly=" + global::System.Uri.EscapeDataString(fetchAvailableMethodsOnly.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetUserauthenticationMethodsWithResult_Call (request, eventListener,sender); } } /// <summary>Used to fetch authentication methods of an existing user</summary> /// <param name="userId">Id of the User whose authentication method details have to be fetched</param> /// <param name="fetchAvailableMethodsOnly">Set as true to fetch the list of available authentication methods for the user</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserAuthenticationMethods>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserAuthenticationMethods> GetUserauthenticationMethodsWithResult(long userId, bool? fetchAvailableMethodsOnly, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + (userId.ToString()) + "/authenticationMethods" + "?" + (null == fetchAvailableMethodsOnly ? global::System.String.Empty : "fetchAvailableMethodsOnly=" + global::System.Uri.EscapeDataString(fetchAvailableMethodsOnly.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetUserauthenticationMethodsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetUserauthenticationMethodsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserAuthenticationMethods>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserAuthenticationMethods> GetUserauthenticationMethodsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.UserAuthenticationMethods.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetUserauthenticationMethods" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetUserauthenticationMethods_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserAuthenticationMethods>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.UserAuthenticationMethods.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetUserauthenticationMethods" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="userId">Id of the User whose authentication method details have to be fetched</param> /// <param name="fetchAvailableMethodsOnly">Set as true to fetch the list of available authentication methods for the user</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetUserauthenticationMethods_Validate(long userId, bool? fetchAvailableMethodsOnly, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get All Users</summary> /// <param name="laptopUsers">Returns only laptop users when set to true. This param is only effective when EdgeMode header /// is passed.</param> /// <param name="userGroupId">Returns the list of users associated to the userGroupId provided.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetUsers(bool? laptopUsers, long? userGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user" + "?" + (null == laptopUsers ? global::System.String.Empty : "laptopUsers=" + global::System.Uri.EscapeDataString(laptopUsers.ToString())) + "&" + (null == userGroupId ? global::System.String.Empty : "userGroupId=" + global::System.Uri.EscapeDataString(userGroupId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetUsers_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Users</summary> /// <param name="viaIdentity"></param> /// <param name="laptopUsers">Returns only laptop users when set to true. This param is only effective when EdgeMode header /// is passed.</param> /// <param name="userGroupId">Returns the list of users associated to the userGroupId provided.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetUsersViaIdentity(global::System.String viaIdentity, bool? laptopUsers, long? userGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/user$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/user'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user" + "?" + (null == laptopUsers ? global::System.String.Empty : "laptopUsers=" + global::System.Uri.EscapeDataString(laptopUsers.ToString())) + "&" + (null == userGroupId ? global::System.String.Empty : "userGroupId=" + global::System.Uri.EscapeDataString(userGroupId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetUsers_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Users</summary> /// <param name="viaIdentity"></param> /// <param name="laptopUsers">Returns only laptop users when set to true. This param is only effective when EdgeMode header /// is passed.</param> /// <param name="userGroupId">Returns the list of users associated to the userGroupId provided.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserListResp> GetUsersViaIdentityWithResult(global::System.String viaIdentity, bool? laptopUsers, long? userGroupId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/user$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/user'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user" + "?" + (null == laptopUsers ? global::System.String.Empty : "laptopUsers=" + global::System.Uri.EscapeDataString(laptopUsers.ToString())) + "&" + (null == userGroupId ? global::System.String.Empty : "userGroupId=" + global::System.Uri.EscapeDataString(userGroupId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetUsersWithResult_Call (request, eventListener,sender); } } /// <summary>Get All Users</summary> /// <param name="laptopUsers">Returns only laptop users when set to true. This param is only effective when EdgeMode header /// is passed.</param> /// <param name="userGroupId">Returns the list of users associated to the userGroupId provided.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserListResp> GetUsersWithResult(bool? laptopUsers, long? userGroupId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user" + "?" + (null == laptopUsers ? global::System.String.Empty : "laptopUsers=" + global::System.Uri.EscapeDataString(laptopUsers.ToString())) + "&" + (null == userGroupId ? global::System.String.Empty : "userGroupId=" + global::System.Uri.EscapeDataString(userGroupId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetUsersWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetUsersWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserListResp> GetUsersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.UserListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetUsers" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetUsers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUserListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.UserListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetUsers" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="laptopUsers">Returns only laptop users when set to true. This param is only effective when EdgeMode header /// is passed.</param> /// <param name="userGroupId">Returns the list of users associated to the userGroupId provided.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetUsers_Validate(bool? laptopUsers, long? userGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details of a blackout window based on id</summary> /// <param name="blackoutWindowId">Id of the Blackout Window whose details have to be fetched</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetV4BlackoutWindowDetails(long blackoutWindowId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindow>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow/" + (blackoutWindowId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetV4BlackoutWindowDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a blackout window based on id</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetV4BlackoutWindowDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindow>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/BlackoutWindow/(?<blackoutWindowId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/BlackoutWindow/{blackoutWindowId}'"); } // replace URI parameters with values from identity var blackoutWindowId = _match.Groups["blackoutWindowId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow/" + blackoutWindowId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetV4BlackoutWindowDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details of a blackout window based on id</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindow>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindow> GetV4BlackoutWindowDetailsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/BlackoutWindow/(?<blackoutWindowId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/BlackoutWindow/{blackoutWindowId}'"); } // replace URI parameters with values from identity var blackoutWindowId = _match.Groups["blackoutWindowId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow/" + blackoutWindowId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetV4BlackoutWindowDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get details of a blackout window based on id</summary> /// <param name="blackoutWindowId">Id of the Blackout Window whose details have to be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindow>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindow> GetV4BlackoutWindowDetailsWithResult(long blackoutWindowId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow/" + (blackoutWindowId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetV4BlackoutWindowDetailsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetV4BlackoutWindowDetailsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindow>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindow> GetV4BlackoutWindowDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.V4BlackoutWindow.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetV4BlackoutWindowDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetV4BlackoutWindowDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindow>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.V4BlackoutWindow.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetV4BlackoutWindowDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="blackoutWindowId">Id of the Blackout Window whose details have to be fetched</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetV4BlackoutWindowDetails_Validate(long blackoutWindowId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get All Blackout Windows</summary> /// <param name="showOnlyCommcellLevel">Shows blackout window at commcell level if set to true.</param> /// <param name="companyId">Shows blackout windows associated with the company whose id has been provided.</param> /// <param name="serverGroupId">Shows blackout windows associated with the server group whose id has been provided.</param> /// <param name="commcellId">Shows blackout windows associated with the commcell whose id has been provided.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetV4BlackoutWindows(bool? showOnlyCommcellLevel, long? companyId, long? serverGroupId, string commcellId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindowsListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow" + "?" + (null == showOnlyCommcellLevel ? global::System.String.Empty : "showOnlyCommcellLevel=" + global::System.Uri.EscapeDataString(showOnlyCommcellLevel.ToString())) + "&" + (null == companyId ? global::System.String.Empty : "companyId=" + global::System.Uri.EscapeDataString(companyId.ToString())) + "&" + (null == serverGroupId ? global::System.String.Empty : "serverGroupId=" + global::System.Uri.EscapeDataString(serverGroupId.ToString())) + "&" + (string.IsNullOrEmpty(commcellId) ? global::System.String.Empty : "commcellId=" + global::System.Uri.EscapeDataString(commcellId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetV4BlackoutWindows_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Blackout Windows</summary> /// <param name="viaIdentity"></param> /// <param name="showOnlyCommcellLevel">Shows blackout window at commcell level if set to true.</param> /// <param name="companyId">Shows blackout windows associated with the company whose id has been provided.</param> /// <param name="serverGroupId">Shows blackout windows associated with the server group whose id has been provided.</param> /// <param name="commcellId">Shows blackout windows associated with the commcell whose id has been provided.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetV4BlackoutWindowsViaIdentity(global::System.String viaIdentity, bool? showOnlyCommcellLevel, long? companyId, long? serverGroupId, string commcellId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindowsListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/BlackoutWindow$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/BlackoutWindow'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow" + "?" + (null == showOnlyCommcellLevel ? global::System.String.Empty : "showOnlyCommcellLevel=" + global::System.Uri.EscapeDataString(showOnlyCommcellLevel.ToString())) + "&" + (null == companyId ? global::System.String.Empty : "companyId=" + global::System.Uri.EscapeDataString(companyId.ToString())) + "&" + (null == serverGroupId ? global::System.String.Empty : "serverGroupId=" + global::System.Uri.EscapeDataString(serverGroupId.ToString())) + "&" + (string.IsNullOrEmpty(commcellId) ? global::System.String.Empty : "commcellId=" + global::System.Uri.EscapeDataString(commcellId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetV4BlackoutWindows_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get All Blackout Windows</summary> /// <param name="viaIdentity"></param> /// <param name="showOnlyCommcellLevel">Shows blackout window at commcell level if set to true.</param> /// <param name="companyId">Shows blackout windows associated with the company whose id has been provided.</param> /// <param name="serverGroupId">Shows blackout windows associated with the server group whose id has been provided.</param> /// <param name="commcellId">Shows blackout windows associated with the commcell whose id has been provided.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindowsListResponse>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindowsListResponse> GetV4BlackoutWindowsViaIdentityWithResult(global::System.String viaIdentity, bool? showOnlyCommcellLevel, long? companyId, long? serverGroupId, string commcellId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/BlackoutWindow$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/BlackoutWindow'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow" + "?" + (null == showOnlyCommcellLevel ? global::System.String.Empty : "showOnlyCommcellLevel=" + global::System.Uri.EscapeDataString(showOnlyCommcellLevel.ToString())) + "&" + (null == companyId ? global::System.String.Empty : "companyId=" + global::System.Uri.EscapeDataString(companyId.ToString())) + "&" + (null == serverGroupId ? global::System.String.Empty : "serverGroupId=" + global::System.Uri.EscapeDataString(serverGroupId.ToString())) + "&" + (string.IsNullOrEmpty(commcellId) ? global::System.String.Empty : "commcellId=" + global::System.Uri.EscapeDataString(commcellId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetV4BlackoutWindowsWithResult_Call (request, eventListener,sender); } } /// <summary>Get All Blackout Windows</summary> /// <param name="showOnlyCommcellLevel">Shows blackout window at commcell level if set to true.</param> /// <param name="companyId">Shows blackout windows associated with the company whose id has been provided.</param> /// <param name="serverGroupId">Shows blackout windows associated with the server group whose id has been provided.</param> /// <param name="commcellId">Shows blackout windows associated with the commcell whose id has been provided.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindowsListResponse>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindowsListResponse> GetV4BlackoutWindowsWithResult(bool? showOnlyCommcellLevel, long? companyId, long? serverGroupId, string commcellId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow" + "?" + (null == showOnlyCommcellLevel ? global::System.String.Empty : "showOnlyCommcellLevel=" + global::System.Uri.EscapeDataString(showOnlyCommcellLevel.ToString())) + "&" + (null == companyId ? global::System.String.Empty : "companyId=" + global::System.Uri.EscapeDataString(companyId.ToString())) + "&" + (null == serverGroupId ? global::System.String.Empty : "serverGroupId=" + global::System.Uri.EscapeDataString(serverGroupId.ToString())) + "&" + (string.IsNullOrEmpty(commcellId) ? global::System.String.Empty : "commcellId=" + global::System.Uri.EscapeDataString(commcellId)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetV4BlackoutWindowsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetV4BlackoutWindowsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindowsListResponse>" /> that /// will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindowsListResponse> GetV4BlackoutWindowsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.V4BlackoutWindowsListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetV4BlackoutWindows" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetV4BlackoutWindows_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IV4BlackoutWindowsListResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.V4BlackoutWindowsListResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetV4BlackoutWindows" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="showOnlyCommcellLevel">Shows blackout window at commcell level if set to true.</param> /// <param name="companyId">Shows blackout windows associated with the company whose id has been provided.</param> /// <param name="serverGroupId">Shows blackout windows associated with the server group whose id has been provided.</param> /// <param name="commcellId">Shows blackout windows associated with the commcell whose id has been provided.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetV4BlackoutWindows_Validate(bool? showOnlyCommcellLevel, long? companyId, long? serverGroupId, string commcellId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(commcellId),commcellId); } } /// <summary>Gives list of valid laptop owner mapping in the response</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetV4LaptopOwnerMappingPreview(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILaptopOwnerMapping>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopOwnerMapping/Preview" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetV4LaptopOwnerMappingPreview_Call (request, onOk,onBadRequest,onForbidden,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetV4LaptopOwnerMappingPreview" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetV4LaptopOwnerMappingPreview_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILaptopOwnerMapping>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.LaptopOwnerMapping.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetV4LaptopOwnerMappingPreview" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetV4LaptopOwnerMappingPreview_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get details for virtual machine</summary> /// <param name="vmUuid">The vmUUID can be obtained from GET /virtualMachines UUID property</param> /// <param name="showInheritedAssociation"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetVMDetails(string vmUuid, bool? showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCfcpthV4VirtualmachinesVmuuidGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VirtualMachines/" + global::System.Uri.EscapeDataString(vmUuid) + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetVMDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details for virtual machine</summary> /// <param name="viaIdentity"></param> /// <param name="showInheritedAssociation"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetVMDetailsViaIdentity(global::System.String viaIdentity, bool? showInheritedAssociation, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCfcpthV4VirtualmachinesVmuuidGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VirtualMachines/(?<vmUUID>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VirtualMachines/{vmUUID}'"); } // replace URI parameters with values from identity var vmUuid = _match.Groups["vmUUID"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VirtualMachines/" + vmUuid + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetVMDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get details for virtual machine</summary> /// <param name="viaIdentity"></param> /// <param name="showInheritedAssociation"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCfcpthV4VirtualmachinesVmuuidGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCfcpthV4VirtualmachinesVmuuidGetResponses200ContentApplicationJsonSchema> GetVMDetailsViaIdentityWithResult(global::System.String viaIdentity, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VirtualMachines/(?<vmUUID>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VirtualMachines/{vmUUID}'"); } // replace URI parameters with values from identity var vmUuid = _match.Groups["vmUUID"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VirtualMachines/" + vmUuid + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetVMDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Get details for virtual machine</summary> /// <param name="vmUuid">The vmUUID can be obtained from GET /virtualMachines UUID property</param> /// <param name="showInheritedAssociation"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCfcpthV4VirtualmachinesVmuuidGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCfcpthV4VirtualmachinesVmuuidGetResponses200ContentApplicationJsonSchema> GetVMDetailsWithResult(string vmUuid, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VirtualMachines/" + global::System.Uri.EscapeDataString(vmUuid) + "?" + (null == showInheritedAssociation ? global::System.String.Empty : "showInheritedAssociation=" + global::System.Uri.EscapeDataString(showInheritedAssociation.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetVMDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetVMDetailsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCfcpthV4VirtualmachinesVmuuidGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCfcpthV4VirtualmachinesVmuuidGetResponses200ContentApplicationJsonSchema> GetVMDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PathsCfcpthV4VirtualmachinesVmuuidGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetVMDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetVMDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCfcpthV4VirtualmachinesVmuuidGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PathsCfcpthV4VirtualmachinesVmuuidGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetVMDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="vmUuid">The vmUUID can be obtained from GET /virtualMachines UUID property</param> /// <param name="showInheritedAssociation"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetVMDetails_Validate(string vmUuid, bool? showInheritedAssociation, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(vmUuid),vmUuid); } } /// <summary>Get the details of vmGroup</summary> /// <param name="vmGroupId">Id of the VmGroup to get</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetVMGroup(long vmGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetVMGroupResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VmGroup/" + (vmGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetVMGroup_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get the details of vmGroup</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetVMGroupViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetVMGroupResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VmGroup/(?<VmGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VmGroup/{VmGroupId}'"); } // replace URI parameters with values from identity var vmGroupId = _match.Groups["VmGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VmGroup/" + vmGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetVMGroup_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetVMGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetVMGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetVMGroupResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetVMGroupResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetVMGroup" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="vmGroupId">Id of the VmGroup to get</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetVMGroup_Validate(long vmGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the list of vault tracker actions.</summary> /// <param name="view">Time period selection for which to fetch actions. Accepted values [lastHour, last24Hours, lastWeek, /// lastMonth, last3Months, last6Months, lastYear, custom]. When custom is selected Actions are filtered based on values provided /// in other params.</param> /// <param name="libraryId">Filter by libraryId</param> /// <param name="policyId">Filter by policyId</param> /// <param name="startTime">Start time of the time range.</param> /// <param name="endTime">End time of the time range.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetVaultTackerActionList(string view, long? libraryId, long? policyId, long? startTime, long? endTime, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetVaultTrackerActionListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VaultTrackerAction" + "?" + (string.IsNullOrEmpty(view) ? global::System.String.Empty : "view=" + global::System.Uri.EscapeDataString(view)) + "&" + (null == libraryId ? global::System.String.Empty : "libraryId=" + global::System.Uri.EscapeDataString(libraryId.ToString())) + "&" + (null == policyId ? global::System.String.Empty : "policyId=" + global::System.Uri.EscapeDataString(policyId.ToString())) + "&" + (null == startTime ? global::System.String.Empty : "startTime=" + global::System.Uri.EscapeDataString(startTime.ToString())) + "&" + (null == endTime ? global::System.String.Empty : "endTime=" + global::System.Uri.EscapeDataString(endTime.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetVaultTackerActionList_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Get the list of vault tracker actions.</summary> /// <param name="viaIdentity"></param> /// <param name="view">Time period selection for which to fetch actions. Accepted values [lastHour, last24Hours, lastWeek, /// lastMonth, last3Months, last6Months, lastYear, custom]. When custom is selected Actions are filtered based on values provided /// in other params.</param> /// <param name="libraryId">Filter by libraryId</param> /// <param name="policyId">Filter by policyId</param> /// <param name="startTime">Start time of the time range.</param> /// <param name="endTime">End time of the time range.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetVaultTackerActionListViaIdentity(global::System.String viaIdentity, string view, long? libraryId, long? policyId, long? startTime, long? endTime, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetVaultTrackerActionListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VaultTrackerAction$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VaultTrackerAction'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VaultTrackerAction" + "?" + (string.IsNullOrEmpty(view) ? global::System.String.Empty : "view=" + global::System.Uri.EscapeDataString(view)) + "&" + (null == libraryId ? global::System.String.Empty : "libraryId=" + global::System.Uri.EscapeDataString(libraryId.ToString())) + "&" + (null == policyId ? global::System.String.Empty : "policyId=" + global::System.Uri.EscapeDataString(policyId.ToString())) + "&" + (null == startTime ? global::System.String.Empty : "startTime=" + global::System.Uri.EscapeDataString(startTime.ToString())) + "&" + (null == endTime ? global::System.String.Empty : "endTime=" + global::System.Uri.EscapeDataString(endTime.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetVaultTackerActionList_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetVaultTackerActionList" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetVaultTackerActionList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetVaultTrackerActionListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetVaultTrackerActionListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetVaultTackerActionList" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="view">Time period selection for which to fetch actions. Accepted values [lastHour, last24Hours, lastWeek, /// lastMonth, last3Months, last6Months, lastYear, custom]. When custom is selected Actions are filtered based on values provided /// in other params.</param> /// <param name="libraryId">Filter by libraryId</param> /// <param name="policyId">Filter by policyId</param> /// <param name="startTime">Start time of the time range.</param> /// <param name="endTime">End time of the time range.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetVaultTackerActionList_Validate(string view, long? libraryId, long? policyId, long? startTime, long? endTime, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(view),view); } } /// <summary>Get the details of vault tracker media.</summary> /// <param name="actionId">List Media by actionId</param> /// <param name="policyId">List Media by policyId</param> /// <param name="containerId">List Media by containerId</param> /// <param name="locationId">List Media by locationId</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetVaultTrackerMediaDetails(long? actionId, long? policyId, long? containerId, long? locationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetVaultTrackerMediaDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VaultTracker/Media" + "?" + (null == actionId ? global::System.String.Empty : "actionId=" + global::System.Uri.EscapeDataString(actionId.ToString())) + "&" + (null == policyId ? global::System.String.Empty : "policyId=" + global::System.Uri.EscapeDataString(policyId.ToString())) + "&" + (null == containerId ? global::System.String.Empty : "containerId=" + global::System.Uri.EscapeDataString(containerId.ToString())) + "&" + (null == locationId ? global::System.String.Empty : "locationId=" + global::System.Uri.EscapeDataString(locationId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetVaultTrackerMediaDetails_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Get the details of vault tracker media.</summary> /// <param name="viaIdentity"></param> /// <param name="actionId">List Media by actionId</param> /// <param name="policyId">List Media by policyId</param> /// <param name="containerId">List Media by containerId</param> /// <param name="locationId">List Media by locationId</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetVaultTrackerMediaDetailsViaIdentity(global::System.String viaIdentity, long? actionId, long? policyId, long? containerId, long? locationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetVaultTrackerMediaDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VaultTracker/Media$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VaultTracker/Media'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VaultTracker/Media" + "?" + (null == actionId ? global::System.String.Empty : "actionId=" + global::System.Uri.EscapeDataString(actionId.ToString())) + "&" + (null == policyId ? global::System.String.Empty : "policyId=" + global::System.Uri.EscapeDataString(policyId.ToString())) + "&" + (null == containerId ? global::System.String.Empty : "containerId=" + global::System.Uri.EscapeDataString(containerId.ToString())) + "&" + (null == locationId ? global::System.String.Empty : "locationId=" + global::System.Uri.EscapeDataString(locationId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetVaultTrackerMediaDetails_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetVaultTrackerMediaDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetVaultTrackerMediaDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGetVaultTrackerMediaDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GetVaultTrackerMediaDetailsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetVaultTrackerMediaDetails" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="actionId">List Media by actionId</param> /// <param name="policyId">List Media by policyId</param> /// <param name="containerId">List Media by containerId</param> /// <param name="locationId">List Media by locationId</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetVaultTrackerMediaDetails_Validate(long? actionId, long? policyId, long? containerId, long? locationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get all snap vendors</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetVendors(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapVendors>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Vendors" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetVendors_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Get all snap vendors</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapVendors>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapVendors> GetVendorsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Vendors" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetVendorsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetVendorsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapVendors>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapVendors> GetVendorsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapVendors.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetVendors" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetVendors_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapVendors>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapVendors.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetVendors" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetVendors_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get all virtual machines</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetVirtualMachines(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IVirtualMachineListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VirtualMachines" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetVirtualMachines_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Get all virtual machines</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IVirtualMachineListResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IVirtualMachineListResp> GetVirtualMachinesWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VirtualMachines" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetVirtualMachinesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetVirtualMachinesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IVirtualMachineListResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IVirtualMachineListResp> GetVirtualMachinesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.VirtualMachineListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetVirtualMachines" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetVirtualMachines_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IVirtualMachineListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.VirtualMachineListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetVirtualMachines" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetVirtualMachines_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>This endpoint is used to return the list of network topology.</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetfirewallTopology(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths8Zh6F2V4NetworktopologyGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetfirewallTopology_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>This endpoint is used to return the detail of network topology.</summary> /// <param name="topologyId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetfirewallTopologyDetails(string topologyId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCvbrweV4NetworktopologyTopologyidGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology/" + global::System.Uri.EscapeDataString(topologyId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetfirewallTopologyDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>This endpoint is used to return the detail of network topology.</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task GetfirewallTopologyDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCvbrweV4NetworktopologyTopologyidGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/NetworkTopology/(?<topologyId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/NetworkTopology/{topologyId}'"); } // replace URI parameters with values from identity var topologyId = _match.Groups["topologyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology/" + topologyId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.GetfirewallTopologyDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>This endpoint is used to return the detail of network topology.</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCvbrweV4NetworktopologyTopologyidGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCvbrweV4NetworktopologyTopologyidGetResponses200ContentApplicationJsonSchema> GetfirewallTopologyDetailsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/NetworkTopology/(?<topologyId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/NetworkTopology/{topologyId}'"); } // replace URI parameters with values from identity var topologyId = _match.Groups["topologyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology/" + topologyId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetfirewallTopologyDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>This endpoint is used to return the detail of network topology.</summary> /// <param name="topologyId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCvbrweV4NetworktopologyTopologyidGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCvbrweV4NetworktopologyTopologyidGetResponses200ContentApplicationJsonSchema> GetfirewallTopologyDetailsWithResult(string topologyId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology/" + global::System.Uri.EscapeDataString(topologyId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetfirewallTopologyDetailsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "GetfirewallTopologyDetailsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCvbrweV4NetworktopologyTopologyidGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCvbrweV4NetworktopologyTopologyidGetResponses200ContentApplicationJsonSchema> GetfirewallTopologyDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PathsCvbrweV4NetworktopologyTopologyidGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetfirewallTopologyDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetfirewallTopologyDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsCvbrweV4NetworktopologyTopologyidGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PathsCvbrweV4NetworktopologyTopologyidGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetfirewallTopologyDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="topologyId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetfirewallTopologyDetails_Validate(string topologyId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(topologyId),topologyId); } } /// <summary>This endpoint is used to return the list of network topology.</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths8Zh6F2V4NetworktopologyGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths8Zh6F2V4NetworktopologyGetResponses200ContentApplicationJsonSchema> GetfirewallTopologyWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.GetfirewallTopologyWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "GetfirewallTopologyWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths8Zh6F2V4NetworktopologyGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths8Zh6F2V4NetworktopologyGetResponses200ContentApplicationJsonSchema> GetfirewallTopologyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths8Zh6F2V4NetworktopologyGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "GetfirewallTopology" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetfirewallTopology_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths8Zh6F2V4NetworktopologyGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths8Zh6F2V4NetworktopologyGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="GetfirewallTopology" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task GetfirewallTopology_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to include instance in SLA. Applicable for Salesforce</summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task IncludeSlaInstance(long instanceId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + (instanceId.ToString()) + "/SLA/Include" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.IncludeSlaInstance_Call (request, onOk,eventListener,sender); } } /// <summary>Used to include instance in SLA. Applicable for Salesforce</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task IncludeSlaInstanceViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Instance/(?<instanceId>[^/]+)/SLA/Include$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Instance/{instanceId}/SLA/Include'"); } // replace URI parameters with values from identity var instanceId = _match.Groups["instanceId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + instanceId + "/SLA/Include" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.IncludeSlaInstance_Call (request, onOk,eventListener,sender); } } /// <summary>Used to include instance in SLA. Applicable for Salesforce</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> IncludeSlaInstanceViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Instance/(?<instanceId>[^/]+)/SLA/Include$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Instance/{instanceId}/SLA/Include'"); } // replace URI parameters with values from identity var instanceId = _match.Groups["instanceId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + instanceId + "/SLA/Include" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.IncludeSlaInstanceWithResult_Call (request, eventListener,sender); } } /// <summary>Used to include instance in SLA. Applicable for Salesforce</summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> IncludeSlaInstanceWithResult(long instanceId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Instance/" + (instanceId.ToString()) + "/SLA/Include" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.IncludeSlaInstanceWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "IncludeSlaInstanceWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> IncludeSlaInstanceWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "IncludeSlaInstance" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task IncludeSlaInstance_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="IncludeSlaInstance" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="instanceId">Id of the instance to modify</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task IncludeSlaInstance_Validate(long instanceId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>To install MediaAgent package on a server</summary> /// <param name="body">Server information where you want to install MediaAgent package.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task InstallMediaAgent(Commvault.Powershell.Models.IInstallMediaAgent body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobId>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.InstallMediaAgent_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>To install MediaAgent package on a server</summary> /// <param name="body">Server information where you want to install MediaAgent package.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobId>" /> that will be complete when handling /// of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobId> InstallMediaAgentWithResult(Commvault.Powershell.Models.IInstallMediaAgent body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.InstallMediaAgentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "InstallMediaAgentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobId>" /> that will be complete when handling /// of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobId> InstallMediaAgentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.JobId.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "InstallMediaAgent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task InstallMediaAgent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobId>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.JobId.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="InstallMediaAgent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Server information where you want to install MediaAgent package.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task InstallMediaAgent_Validate(Commvault.Powershell.Models.IInstallMediaAgent body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API for snap instant clone delete operation</summary> /// <param name="arrayId"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task InstantCloneDelete(long arrayId, Commvault.Powershell.Models.ISnapNodeReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/InstantClone/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.InstantCloneDelete_Call (request, onOk,eventListener,sender); } } /// <summary>API for snap instant clone delete operation</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task InstantCloneDeleteViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapNodeReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/InstantClone/Delete$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/InstantClone/Delete'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/InstantClone/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.InstantCloneDelete_Call (request, onOk,eventListener,sender); } } /// <summary>API for snap instant clone delete operation</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> InstantCloneDeleteViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapNodeReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/InstantClone/Delete$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/InstantClone/Delete'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/InstantClone/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.InstantCloneDeleteWithResult_Call (request, eventListener,sender); } } /// <summary>API for snap instant clone delete operation</summary> /// <param name="arrayId"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> InstantCloneDeleteWithResult(long arrayId, Commvault.Powershell.Models.ISnapNodeReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/InstantClone/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.InstantCloneDeleteWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "InstantCloneDeleteWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> InstantCloneDeleteWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "InstantCloneDelete" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task InstantCloneDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="InstantCloneDelete" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="arrayId"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task InstantCloneDelete_Validate(long arrayId, Commvault.Powershell.Models.ISnapNodeReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary> /// API for snap instant clone force delete operation. Please be aware, triggering this API will not delete the clones from /// the storage array, so ensure that you delete clones on the array before using this operation. /// </summary> /// <param name="arrayId"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task InstantCloneForceDelete(long arrayId, Commvault.Powershell.Models.ISnapNodeReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/InstantClone/Delete/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.InstantCloneForceDelete_Call (request, onOk,eventListener,sender); } } /// <summary> /// API for snap instant clone force delete operation. Please be aware, triggering this API will not delete the clones from /// the storage array, so ensure that you delete clones on the array before using this operation. /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task InstantCloneForceDeleteViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapNodeReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/InstantClone/Delete/Force$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/InstantClone/Delete/Force'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/InstantClone/Delete/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.InstantCloneForceDelete_Call (request, onOk,eventListener,sender); } } /// <summary> /// API for snap instant clone force delete operation. Please be aware, triggering this API will not delete the clones from /// the storage array, so ensure that you delete clones on the array before using this operation. /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> InstantCloneForceDeleteViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapNodeReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/InstantClone/Delete/Force$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/InstantClone/Delete/Force'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/InstantClone/Delete/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.InstantCloneForceDeleteWithResult_Call (request, eventListener,sender); } } /// <summary> /// API for snap instant clone force delete operation. Please be aware, triggering this API will not delete the clones from /// the storage array, so ensure that you delete clones on the array before using this operation. /// </summary> /// <param name="arrayId"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> InstantCloneForceDeleteWithResult(long arrayId, Commvault.Powershell.Models.ISnapNodeReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/InstantClone/Delete/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.InstantCloneForceDeleteWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "InstantCloneForceDeleteWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> InstantCloneForceDeleteWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "InstantCloneForceDelete" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task InstantCloneForceDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="InstantCloneForceDelete" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="arrayId"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task InstantCloneForceDelete_Validate(long arrayId, Commvault.Powershell.Models.ISnapNodeReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>To start the data collection job on inventory</summary> /// <param name="inventoryId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task InventoryCrawl(long inventoryId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + (inventoryId.ToString()) + "/Crawl" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.InventoryCrawl_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>To start the data collection job on inventory</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task InventoryCrawlViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/InventoryManager/Inventory/(?<inventoryId>[^/]+)/Crawl$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/InventoryManager/Inventory/{inventoryId}/Crawl'"); } // replace URI parameters with values from identity var inventoryId = _match.Groups["inventoryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + inventoryId + "/Crawl" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.InventoryCrawl_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>To start the data collection job on inventory</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> InventoryCrawlViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/InventoryManager/Inventory/(?<inventoryId>[^/]+)/Crawl$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/InventoryManager/Inventory/{inventoryId}/Crawl'"); } // replace URI parameters with values from identity var inventoryId = _match.Groups["inventoryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + inventoryId + "/Crawl" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.InventoryCrawlWithResult_Call (request, eventListener,sender); } } /// <summary>To start the data collection job on inventory</summary> /// <param name="inventoryId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> InventoryCrawlWithResult(long inventoryId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/InventoryManager/Inventory/" + (inventoryId.ToString()) + "/Crawl" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.InventoryCrawlWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "InventoryCrawlWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> InventoryCrawlWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "InventoryCrawl" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task InventoryCrawl_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="InventoryCrawl" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="inventoryId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task InventoryCrawl_Validate(long inventoryId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Fetch all the modifiers</summary> /// <param name="clusterId">Id of the cluster whose modifier has to be listed.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task Kubernetes(long clusterId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + (clusterId.ToString()) + "/Modifier" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.Kubernetes_Call (request, onOk,eventListener,sender); } } /// <summary>Kubernetes a Modifier</summary> /// <param name="clusterId">Id of the cluster whose modifier has to be created.</param> /// <param name="body">Request body for K8s Modifier</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task Kubernetes1(long clusterId, Commvault.Powershell.Models.IK8SRestoreModifierApireq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + (clusterId.ToString()) + "/Modifier" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.Kubernetes1_Call (request, onOk,eventListener,sender); } } /// <summary>Kubernetes a Modifier</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request body for K8s Modifier</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task Kubernetes1ViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IK8SRestoreModifierApireq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Kubernetes/(?<clusterId>[^/]+)/Modifier$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Kubernetes/{clusterId}/Modifier'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + clusterId + "/Modifier" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.Kubernetes1_Call (request, onOk,eventListener,sender); } } /// <summary>Kubernetes a Modifier</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request body for K8s Modifier</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> Kubernetes1ViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IK8SRestoreModifierApireq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Kubernetes/(?<clusterId>[^/]+)/Modifier$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Kubernetes/{clusterId}/Modifier'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + clusterId + "/Modifier" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.Kubernetes1WithResult_Call (request, eventListener,sender); } } /// <summary>Kubernetes a Modifier</summary> /// <param name="clusterId">Id of the cluster whose modifier has to be created.</param> /// <param name="body">Request body for K8s Modifier</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> Kubernetes1WithResult(long clusterId, Commvault.Powershell.Models.IK8SRestoreModifierApireq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + (clusterId.ToString()) + "/Modifier" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.Kubernetes1WithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "Kubernetes1WithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> Kubernetes1WithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "Kubernetes1" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task Kubernetes1_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="Kubernetes1" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="clusterId">Id of the cluster whose modifier has to be created.</param> /// <param name="body">Request body for K8s Modifier</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task Kubernetes1_Validate(long clusterId, Commvault.Powershell.Models.IK8SRestoreModifierApireq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Fetch all the modifiers</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task KubernetesViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Kubernetes/(?<clusterId>[^/]+)/Modifier$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Kubernetes/{clusterId}/Modifier'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + clusterId + "/Modifier" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.Kubernetes_Call (request, onOk,eventListener,sender); } } /// <summary>Fetch all the modifiers</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp> KubernetesViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Kubernetes/(?<clusterId>[^/]+)/Modifier$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Kubernetes/{clusterId}/Modifier'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + clusterId + "/Modifier" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.KubernetesWithResult_Call (request, eventListener,sender); } } /// <summary>Fetch all the modifiers</summary> /// <param name="clusterId">Id of the cluster whose modifier has to be listed.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp> KubernetesWithResult(long clusterId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + (clusterId.ToString()) + "/Modifier" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.KubernetesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "KubernetesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp> KubernetesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.K8SRestoreModifierApiresp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "Kubernetes" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task Kubernetes_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.K8SRestoreModifierApiresp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="Kubernetes" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="clusterId">Id of the cluster whose modifier has to be listed.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task Kubernetes_Validate(long clusterId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Returns a list of all entity settings added</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ListAddedEntitySettings(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAddedEntitySettings>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AddedEntitySettings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ListAddedEntitySettings_Call (request, onOk,eventListener,sender); } } /// <summary>Returns a list of all entity settings added</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAddedEntitySettings>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAddedEntitySettings> ListAddedEntitySettingsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AddedEntitySettings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ListAddedEntitySettingsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ListAddedEntitySettingsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAddedEntitySettings>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAddedEntitySettings> ListAddedEntitySettingsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ListAddedEntitySettings.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "ListAddedEntitySettings" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ListAddedEntitySettings_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAddedEntitySettings>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ListAddedEntitySettings.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ListAddedEntitySettings" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ListAddedEntitySettings_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get list of global settings used to modify system default behaviour</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ListAddedGlobalSettings(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAddedGlobalSettings>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AddedGlobalSettings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ListAddedGlobalSettings_Call (request, onOk,eventListener,sender); } } /// <summary>Get list of global settings used to modify system default behaviour</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAddedGlobalSettings>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAddedGlobalSettings> ListAddedGlobalSettingsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AddedGlobalSettings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ListAddedGlobalSettingsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ListAddedGlobalSettingsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAddedGlobalSettings>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAddedGlobalSettings> ListAddedGlobalSettingsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ListAddedGlobalSettings.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "ListAddedGlobalSettings" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ListAddedGlobalSettings_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAddedGlobalSettings>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ListAddedGlobalSettings.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ListAddedGlobalSettings" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ListAddedGlobalSettings_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>List all available settings that can be added to entity or global</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ListAvailableSettings(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAdditionalSettings>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LookupSettings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ListAvailableSettings_Call (request, onOk,eventListener,sender); } } /// <summary>List all available settings that can be added to entity or global</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAdditionalSettings>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAdditionalSettings> ListAvailableSettingsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LookupSettings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ListAvailableSettingsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ListAvailableSettingsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAdditionalSettings>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAdditionalSettings> ListAvailableSettingsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ListAdditionalSettings.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "ListAvailableSettings" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ListAvailableSettings_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListAdditionalSettings>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ListAdditionalSettings.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ListAvailableSettings" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ListAvailableSettings_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>This end point return the list of failover groups</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ListFailoverGroups(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsT0Pnd9V4FailovergroupsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ListFailoverGroups_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ListFailoverGroups" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ListFailoverGroups_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPathsT0Pnd9V4FailovergroupsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PathsT0Pnd9V4FailovergroupsGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ListFailoverGroups" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ListFailoverGroups_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the details of all Hypervisor</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ListHypervisors(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListHypervisors>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ListHypervisors_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ListHypervisors" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ListHypervisors_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListHypervisors>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ListHypervisors.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ListHypervisors" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ListHypervisors_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Get the details of all cluster</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ListKubernetesCluster(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListClusters>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/cluster" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ListKubernetesCluster_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ListKubernetesCluster" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ListKubernetesCluster_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IListClusters>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.ListClusters.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ListKubernetesCluster" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ListKubernetesCluster_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Listing Snapshot of a particular array</summary> /// <param name="arrayId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ListSnapshots(long arrayId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1Wqi7F0V4StoragearraysArrayidSnapsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ListSnapshots_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Listing Snapshot of a particular array</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ListSnapshotsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1Wqi7F0V4StoragearraysArrayidSnapsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ListSnapshots_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Listing Snapshot of a particular array</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1Wqi7F0V4StoragearraysArrayidSnapsGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1Wqi7F0V4StoragearraysArrayidSnapsGetResponses200ContentApplicationJsonSchema> ListSnapshotsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ListSnapshotsWithResult_Call (request, eventListener,sender); } } /// <summary>Listing Snapshot of a particular array</summary> /// <param name="arrayId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1Wqi7F0V4StoragearraysArrayidSnapsGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1Wqi7F0V4StoragearraysArrayidSnapsGetResponses200ContentApplicationJsonSchema> ListSnapshotsWithResult(long arrayId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ListSnapshotsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ListSnapshotsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1Wqi7F0V4StoragearraysArrayidSnapsGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1Wqi7F0V4StoragearraysArrayidSnapsGetResponses200ContentApplicationJsonSchema> ListSnapshotsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths1Wqi7F0V4StoragearraysArrayidSnapsGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "ListSnapshots" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ListSnapshots_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths1Wqi7F0V4StoragearraysArrayidSnapsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths1Wqi7F0V4StoragearraysArrayidSnapsGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ListSnapshots" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="arrayId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ListSnapshots_Validate(long arrayId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// Used to fetch available media agents which can be added as access paths for local storage /// </summary> /// <param name="storagePoolId">Id of the local storage pool whose media agent has to be shared</param> /// <param name="backupLocationId">Id of the backup location of which media agent has to be shared</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task LocalGetEligibleMediaAgentsForAccessPath(long storagePoolId, long backupLocationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath/MediaAgents" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.LocalGetEligibleMediaAgentsForAccessPath_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary> /// Used to fetch available media agents which can be added as access paths for local storage /// </summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task LocalGetEligibleMediaAgentsForAccessPathViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath/MediaAgents$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath/MediaAgents'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath/MediaAgents" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.LocalGetEligibleMediaAgentsForAccessPath_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary> /// Used to fetch available media agents which can be added as access paths for local storage /// </summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList> LocalGetEligibleMediaAgentsForAccessPathViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath/MediaAgents$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath/MediaAgents'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath/MediaAgents" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.LocalGetEligibleMediaAgentsForAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary> /// Used to fetch available media agents which can be added as access paths for local storage /// </summary> /// <param name="storagePoolId">Id of the local storage pool whose media agent has to be shared</param> /// <param name="backupLocationId">Id of the backup location of which media agent has to be shared</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList> LocalGetEligibleMediaAgentsForAccessPathWithResult(long storagePoolId, long backupLocationId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath/MediaAgents" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.LocalGetEligibleMediaAgentsForAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "LocalGetEligibleMediaAgentsForAccessPathWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList> LocalGetEligibleMediaAgentsForAccessPathWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MediaAgentList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "LocalGetEligibleMediaAgentsForAccessPath" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task LocalGetEligibleMediaAgentsForAccessPath_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMediaAgentList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MediaAgentList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="LocalGetEligibleMediaAgentsForAccessPath" /> method. Call this like the actual call, /// but you will get validation events back. /// </summary> /// <param name="storagePoolId">Id of the local storage pool whose media agent has to be shared</param> /// <param name="backupLocationId">Id of the backup location of which media agent has to be shared</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task LocalGetEligibleMediaAgentsForAccessPath_Validate(long storagePoolId, long backupLocationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Manage Credentials configured for Cyber Resilience</summary> /// <param name="body">CyberResilienceManageCredentials</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ManageCyberResilienceCredentials(Commvault.Powershell.Models.ICyberResilienceManageCredentials body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CyberResilience/Credentials" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ManageCyberResilienceCredentials_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Manage Credentials configured for Cyber Resilience</summary> /// <param name="body">CyberResilienceManageCredentials</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse> ManageCyberResilienceCredentialsWithResult(Commvault.Powershell.Models.ICyberResilienceManageCredentials body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CyberResilience/Credentials" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ManageCyberResilienceCredentialsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "ManageCyberResilienceCredentialsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>" /> that /// will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse> ManageCyberResilienceCredentialsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "ManageCyberResilienceCredentials" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ManageCyberResilienceCredentials_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ManageCyberResilienceCredentials" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="body">CyberResilienceManageCredentials</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ManageCyberResilienceCredentials_Validate(Commvault.Powershell.Models.ICyberResilienceManageCredentials body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Perform DDB disk management operations on MediaAgent</summary> /// <param name="mediaAgentId">Id of the MediaAgent</param> /// <param name="body">Request to perform DDB disk management operations on MediaAgent</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task MediaAgentDdbDiskMgmt(long mediaAgentId, Commvault.Powershell.Models.IMaddbDiskMgmtReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMaddbDiskMgmtResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + (mediaAgentId.ToString()) + "/DDB/Disks" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.MediaAgentDdbDiskMgmt_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Perform DDB disk management operations on MediaAgent</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request to perform DDB disk management operations on MediaAgent</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task MediaAgentDdbDiskMgmtViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IMaddbDiskMgmtReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMaddbDiskMgmtResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/mediaAgent/(?<mediaAgentId>[^/]+)/DDB/Disks$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/mediaAgent/{mediaAgentId}/DDB/Disks'"); } // replace URI parameters with values from identity var mediaAgentId = _match.Groups["mediaAgentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + mediaAgentId + "/DDB/Disks" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.MediaAgentDdbDiskMgmt_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "MediaAgentDdbDiskMgmt" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task MediaAgentDdbDiskMgmt_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IMaddbDiskMgmtResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.MaddbDiskMgmtResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="MediaAgentDdbDiskMgmt" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="mediaAgentId">Id of the MediaAgent</param> /// <param name="body">Request to perform DDB disk management operations on MediaAgent</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task MediaAgentDdbDiskMgmt_Validate(long mediaAgentId, Commvault.Powershell.Models.IMaddbDiskMgmtReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary> /// API for snap multi node force unmount operation. Please be aware, triggering this API will not physically unmount the /// clones from the storage array or MA, so ensure that you unmapped the clones on the array and cleanup the mount host and /// LVM before using this operation. /// </summary> /// <param name="arrayId"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task MultiNodeForceUnmount(long arrayId, Commvault.Powershell.Models.ISnapNodeReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/MultiNode/Unmount/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.MultiNodeForceUnmount_Call (request, onOk,eventListener,sender); } } /// <summary> /// API for snap multi node force unmount operation. Please be aware, triggering this API will not physically unmount the /// clones from the storage array or MA, so ensure that you unmapped the clones on the array and cleanup the mount host and /// LVM before using this operation. /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task MultiNodeForceUnmountViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapNodeReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/MultiNode/Unmount/Force$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/MultiNode/Unmount/Force'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/MultiNode/Unmount/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.MultiNodeForceUnmount_Call (request, onOk,eventListener,sender); } } /// <summary> /// API for snap multi node force unmount operation. Please be aware, triggering this API will not physically unmount the /// clones from the storage array or MA, so ensure that you unmapped the clones on the array and cleanup the mount host and /// LVM before using this operation. /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> MultiNodeForceUnmountViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapNodeReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/MultiNode/Unmount/Force$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/MultiNode/Unmount/Force'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/MultiNode/Unmount/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.MultiNodeForceUnmountWithResult_Call (request, eventListener,sender); } } /// <summary> /// API for snap multi node force unmount operation. Please be aware, triggering this API will not physically unmount the /// clones from the storage array or MA, so ensure that you unmapped the clones on the array and cleanup the mount host and /// LVM before using this operation. /// </summary> /// <param name="arrayId"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> MultiNodeForceUnmountWithResult(long arrayId, Commvault.Powershell.Models.ISnapNodeReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/MultiNode/Unmount/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.MultiNodeForceUnmountWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "MultiNodeForceUnmountWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> MultiNodeForceUnmountWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "MultiNodeForceUnmount" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task MultiNodeForceUnmount_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="MultiNodeForceUnmount" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="arrayId"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task MultiNodeForceUnmount_Validate(long arrayId, Commvault.Powershell.Models.ISnapNodeReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API for snap multi node unmount operation</summary> /// <param name="arrayId"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task MultiNodeUnmount(long arrayId, Commvault.Powershell.Models.ISnapNodeReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/MultiNode/Unmount" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.MultiNodeUnmount_Call (request, onOk,eventListener,sender); } } /// <summary>API for snap multi node unmount operation</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task MultiNodeUnmountViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapNodeReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/MultiNode/Unmount$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/MultiNode/Unmount'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/MultiNode/Unmount" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.MultiNodeUnmount_Call (request, onOk,eventListener,sender); } } /// <summary>API for snap multi node unmount operation</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> MultiNodeUnmountViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapNodeReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/MultiNode/Unmount$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/MultiNode/Unmount'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/MultiNode/Unmount" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.MultiNodeUnmountWithResult_Call (request, eventListener,sender); } } /// <summary>API for snap multi node unmount operation</summary> /// <param name="arrayId"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> MultiNodeUnmountWithResult(long arrayId, Commvault.Powershell.Models.ISnapNodeReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/MultiNode/Unmount" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.MultiNodeUnmountWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "MultiNodeUnmountWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> MultiNodeUnmountWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "MultiNodeUnmount" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task MultiNodeUnmount_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="MultiNodeUnmount" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="arrayId"></param> /// <param name="body">Request template for multi node unmount and instant clone delete</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task MultiNodeUnmount_Validate(long arrayId, Commvault.Powershell.Models.ISnapNodeReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to perform various media level operations on a Tape Storage</summary> /// <param name="libraryId">Id of the library to view the data</param> /// <param name="body">Request body to perform tape media operations</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PerformTapeMediaOperation(long libraryId, Commvault.Powershell.Models.ITapeMediaOperationsReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + (libraryId.ToString()) + "/Media" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PerformTapeMediaOperation_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>API to perform various media level operations on a Tape Storage</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request body to perform tape media operations</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PerformTapeMediaOperationViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ITapeMediaOperationsReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Tape/(?<libraryId>[^/]+)/Media$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Tape/{libraryId}/Media'"); } // replace URI parameters with values from identity var libraryId = _match.Groups["libraryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + libraryId + "/Media" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PerformTapeMediaOperation_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>API to perform various media level operations on a Tape Storage</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request body to perform tape media operations</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> PerformTapeMediaOperationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ITapeMediaOperationsReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Tape/(?<libraryId>[^/]+)/Media$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Tape/{libraryId}/Media'"); } // replace URI parameters with values from identity var libraryId = _match.Groups["libraryId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + libraryId + "/Media" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PerformTapeMediaOperationWithResult_Call (request, eventListener,sender); } } /// <summary>API to perform various media level operations on a Tape Storage</summary> /// <param name="libraryId">Id of the library to view the data</param> /// <param name="body">Request body to perform tape media operations</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> PerformTapeMediaOperationWithResult(long libraryId, Commvault.Powershell.Models.ITapeMediaOperationsReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + (libraryId.ToString()) + "/Media" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PerformTapeMediaOperationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "PerformTapeMediaOperationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> PerformTapeMediaOperationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PerformTapeMediaOperation" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PerformTapeMediaOperation_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PerformTapeMediaOperation" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="libraryId">Id of the library to view the data</param> /// <param name="body">Request body to perform tape media operations</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PerformTapeMediaOperation_Validate(long libraryId, Commvault.Powershell.Models.ITapeMediaOperationsReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Send job details to pick or unpick jobs for snapshot catalog</summary> /// <param name="planId">plan Id</param> /// <param name="backupDestinationId">Backup Destination Id</param> /// <param name="body">Job details for unpicking jobs for snapshot catalog.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PickUnpickJobsForCatalog(long planId, long backupDestinationId, Commvault.Powershell.Models.IJobsForSnapCatalog body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) + "/SnapCatalog/Jobs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PickUnpickJobsForCatalog_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Send job details to pick or unpick jobs for snapshot catalog</summary> /// <param name="viaIdentity"></param> /// <param name="body">Job details for unpicking jobs for snapshot catalog.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PickUnpickJobsForCatalogViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IJobsForSnapCatalog body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/(?<planId>[^/]+)/BackupDestination/(?<backupDestinationId>[^/]+)/SnapCatalog/Jobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/{planId}/BackupDestination/{backupDestinationId}/SnapCatalog/Jobs'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["backupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + planId + "/BackupDestination/" + backupDestinationId + "/SnapCatalog/Jobs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PickUnpickJobsForCatalog_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Send job details to pick or unpick jobs for snapshot catalog</summary> /// <param name="viaIdentity"></param> /// <param name="body">Job details for unpicking jobs for snapshot catalog.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PickUnpickJobsForCatalogViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IJobsForSnapCatalog body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/(?<planId>[^/]+)/BackupDestination/(?<backupDestinationId>[^/]+)/SnapCatalog/Jobs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/{planId}/BackupDestination/{backupDestinationId}/SnapCatalog/Jobs'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["backupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + planId + "/BackupDestination/" + backupDestinationId + "/SnapCatalog/Jobs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PickUnpickJobsForCatalogWithResult_Call (request, eventListener,sender); } } /// <summary>Send job details to pick or unpick jobs for snapshot catalog</summary> /// <param name="planId">plan Id</param> /// <param name="backupDestinationId">Backup Destination Id</param> /// <param name="body">Job details for unpicking jobs for snapshot catalog.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PickUnpickJobsForCatalogWithResult(long planId, long backupDestinationId, Commvault.Powershell.Models.IJobsForSnapCatalog body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) + "/SnapCatalog/Jobs" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PickUnpickJobsForCatalogWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PickUnpickJobsForCatalogWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PickUnpickJobsForCatalogWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PickUnpickJobsForCatalog" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PickUnpickJobsForCatalog_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PickUnpickJobsForCatalog" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="planId">plan Id</param> /// <param name="backupDestinationId">Backup Destination Id</param> /// <param name="body">Job details for unpicking jobs for snapshot catalog.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PickUnpickJobsForCatalog_Validate(long planId, long backupDestinationId, Commvault.Powershell.Models.IJobsForSnapCatalog body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Pin triggered alerts</summary> /// <param name="id"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PinTriggeredAlerts(long id, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + (id.ToString()) + "/Pin" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PinTriggeredAlerts_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Pin triggered alerts</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PinTriggeredAlertsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/TriggeredAlerts/(?<id>[^/]+)/Pin$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/TriggeredAlerts/{id}/Pin'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + id + "/Pin" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PinTriggeredAlerts_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Pin triggered alerts</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PinTriggeredAlertsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/TriggeredAlerts/(?<id>[^/]+)/Pin$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/TriggeredAlerts/{id}/Pin'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + id + "/Pin" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PinTriggeredAlertsWithResult_Call (request, eventListener,sender); } } /// <summary>Pin triggered alerts</summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PinTriggeredAlertsWithResult(long id, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + (id.ToString()) + "/Pin" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PinTriggeredAlertsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PinTriggeredAlertsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PinTriggeredAlertsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PinTriggeredAlerts" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PinTriggeredAlerts_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PinTriggeredAlerts" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PinTriggeredAlerts_Validate(long id, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to perform planned failover for failover group</summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="drOperation">Name of DR operation. Case insensitive</param> /// <param name="skipDisableNetworkAdapter">Whether to skip disabling network adapter in DR job</param> /// <param name="replicationId">Replication ID of particular VM in group to perform DR job on</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PlannedFailoverGroup(long failoverGroupId, string drOperation, bool? skipDisableNetworkAdapter, long? replicationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobId>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + (failoverGroupId.ToString()) + "/Action/" + global::System.Uri.EscapeDataString(drOperation) + "?" + (null == skipDisableNetworkAdapter ? global::System.String.Empty : "skipDisableNetworkAdapter=" + global::System.Uri.EscapeDataString(skipDisableNetworkAdapter.ToString())) + "&" + (null == replicationId ? global::System.String.Empty : "replicationId=" + global::System.Uri.EscapeDataString(replicationId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PlannedFailoverGroup_Call (request, onOk,onBadRequest,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>API to perform planned failover for failover group</summary> /// <param name="viaIdentity"></param> /// <param name="skipDisableNetworkAdapter">Whether to skip disabling network adapter in DR job</param> /// <param name="replicationId">Replication ID of particular VM in group to perform DR job on</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PlannedFailoverGroupViaIdentity(global::System.String viaIdentity, bool? skipDisableNetworkAdapter, long? replicationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobId>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/FailoverGroups/(?<failoverGroupId>[^/]+)/Action/(?<drOperation>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/FailoverGroups/{failoverGroupId}/Action/{drOperation}'"); } // replace URI parameters with values from identity var failoverGroupId = _match.Groups["failoverGroupId"].Value; var drOperation = _match.Groups["drOperation"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + failoverGroupId + "/Action/" + drOperation + "?" + (null == skipDisableNetworkAdapter ? global::System.String.Empty : "skipDisableNetworkAdapter=" + global::System.Uri.EscapeDataString(skipDisableNetworkAdapter.ToString())) + "&" + (null == replicationId ? global::System.String.Empty : "replicationId=" + global::System.Uri.EscapeDataString(replicationId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PlannedFailoverGroup_Call (request, onOk,onBadRequest,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PlannedFailoverGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PlannedFailoverGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobId>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.JobId.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PlannedFailoverGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="drOperation">Name of DR operation. Case insensitive</param> /// <param name="skipDisableNetworkAdapter">Whether to skip disabling network adapter in DR job</param> /// <param name="replicationId">Replication ID of particular VM in group to perform DR job on</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PlannedFailoverGroup_Validate(long failoverGroupId, string drOperation, bool? skipDisableNetworkAdapter, long? replicationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(drOperation),drOperation); } } /// <summary>This endpoint is used to create network topology.</summary> /// <param name="body">FirewallTopologyReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PostFirewallTopology(Commvault.Powershell.Models.IFirewallTopologyCreateReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFirewallTopologyCreateResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PostFirewallTopology_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>This endpoint is used to create network topology.</summary> /// <param name="body">FirewallTopologyReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFirewallTopologyCreateResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFirewallTopologyCreateResp> PostFirewallTopologyWithResult(Commvault.Powershell.Models.IFirewallTopologyCreateReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PostFirewallTopologyWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PostFirewallTopologyWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFirewallTopologyCreateResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFirewallTopologyCreateResp> PostFirewallTopologyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.FirewallTopologyCreateResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PostFirewallTopology" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PostFirewallTopology_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IFirewallTopologyCreateResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.FirewallTopologyCreateResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PostFirewallTopology" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">FirewallTopologyReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PostFirewallTopology_Validate(Commvault.Powershell.Models.IFirewallTopologyCreateReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Simplified API to create a laptop</summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PostLaptop(Commvault.Powershell.Models.IAddLaptop body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAddLaptopResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Laptop" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PostLaptop_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>API to create laptop owner mappings</summary> /// <param name="body">List of laptop owner mappings to be added</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PostLaptopOwnerMapping(Commvault.Powershell.Models.ICreateLaptopOwnerMapping body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopOwnerMapping" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PostLaptopOwnerMapping_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>API to create laptop owner mappings</summary> /// <param name="body">List of laptop owner mappings to be added</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PostLaptopOwnerMappingWithResult(Commvault.Powershell.Models.ICreateLaptopOwnerMapping body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopOwnerMapping" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PostLaptopOwnerMappingWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PostLaptopOwnerMappingWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PostLaptopOwnerMappingWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PostLaptopOwnerMapping" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PostLaptopOwnerMapping_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PostLaptopOwnerMapping" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">List of laptop owner mappings to be added</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PostLaptopOwnerMapping_Validate(Commvault.Powershell.Models.ICreateLaptopOwnerMapping body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Simplified API to create a laptop</summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAddLaptopResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAddLaptopResp> PostLaptopWithResult(Commvault.Powershell.Models.IAddLaptop body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Laptop" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PostLaptopWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PostLaptopWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAddLaptopResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAddLaptopResp> PostLaptopWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AddLaptopResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PostLaptop" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PostLaptop_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IAddLaptopResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.AddLaptopResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PostLaptop" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PostLaptop_Validate(Commvault.Powershell.Models.IAddLaptop body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Deletes the VM.</summary> /// <param name="vmGuid">GUID of the Provisioned VM</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PostVMActionDelete(string vmGuid, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + global::System.Uri.EscapeDataString(vmGuid) + "/Action/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PostVMActionDelete_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Deletes the VM.</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PostVMActionDeleteViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VM/(?<vmGUID>[^/]+)/Action/Delete$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VM/{vmGUID}/Action/Delete'"); } // replace URI parameters with values from identity var vmGuid = _match.Groups["vmGUID"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + vmGuid + "/Action/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PostVMActionDelete_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Deletes the VM.</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PostVMActionDeleteViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VM/(?<vmGUID>[^/]+)/Action/Delete$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VM/{vmGUID}/Action/Delete'"); } // replace URI parameters with values from identity var vmGuid = _match.Groups["vmGUID"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + vmGuid + "/Action/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PostVMActionDeleteWithResult_Call (request, eventListener,sender); } } /// <summary>Deletes the VM.</summary> /// <param name="vmGuid">GUID of the Provisioned VM</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PostVMActionDeleteWithResult(string vmGuid, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + global::System.Uri.EscapeDataString(vmGuid) + "/Action/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PostVMActionDeleteWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PostVMActionDeleteWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PostVMActionDeleteWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PostVMActionDelete" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PostVMActionDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PostVMActionDelete" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="vmGuid">GUID of the Provisioned VM</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PostVMActionDelete_Validate(string vmGuid, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(vmGuid),vmGuid); } } /// <summary>Refreshes the VM.</summary> /// <param name="vmGuid">GUID of the Provisioned VM</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PostVMActionRefresh(string vmGuid, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + global::System.Uri.EscapeDataString(vmGuid) + "/Action/Refresh" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PostVMActionRefresh_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Refreshes the VM.</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PostVMActionRefreshViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VM/(?<vmGUID>[^/]+)/Action/Refresh$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VM/{vmGUID}/Action/Refresh'"); } // replace URI parameters with values from identity var vmGuid = _match.Groups["vmGUID"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + vmGuid + "/Action/Refresh" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PostVMActionRefresh_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Refreshes the VM.</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PostVMActionRefreshViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VM/(?<vmGUID>[^/]+)/Action/Refresh$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VM/{vmGUID}/Action/Refresh'"); } // replace URI parameters with values from identity var vmGuid = _match.Groups["vmGUID"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + vmGuid + "/Action/Refresh" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PostVMActionRefreshWithResult_Call (request, eventListener,sender); } } /// <summary>Refreshes the VM.</summary> /// <param name="vmGuid">GUID of the Provisioned VM</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PostVMActionRefreshWithResult(string vmGuid, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + global::System.Uri.EscapeDataString(vmGuid) + "/Action/Refresh" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PostVMActionRefreshWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PostVMActionRefreshWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PostVMActionRefreshWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PostVMActionRefresh" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PostVMActionRefresh_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PostVMActionRefresh" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="vmGuid">GUID of the Provisioned VM</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PostVMActionRefresh_Validate(string vmGuid, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(vmGuid),vmGuid); } } /// <summary>Renew the VM with the provided timestamp.</summary> /// <param name="vmGuid">GUID of the Provisioned VM</param> /// <param name="body">The renewal timestamp has to be provided in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PostVMActionRenew(string vmGuid, Commvault.Powershell.Models.IPaths1C2BvcjV4VMVmguidActionRenewPostRequestbodyContentApplicationJsonSchema body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + global::System.Uri.EscapeDataString(vmGuid) + "/Action/Renew" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PostVMActionRenew_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Renew the VM with the provided timestamp.</summary> /// <param name="viaIdentity"></param> /// <param name="body">The renewal timestamp has to be provided in unix format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PostVMActionRenewViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IPaths1C2BvcjV4VMVmguidActionRenewPostRequestbodyContentApplicationJsonSchema body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VM/(?<vmGUID>[^/]+)/Action/Renew$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VM/{vmGUID}/Action/Renew'"); } // replace URI parameters with values from identity var vmGuid = _match.Groups["vmGUID"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + vmGuid + "/Action/Renew" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PostVMActionRenew_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Renew the VM with the provided timestamp.</summary> /// <param name="viaIdentity"></param> /// <param name="body">The renewal timestamp has to be provided in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PostVMActionRenewViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IPaths1C2BvcjV4VMVmguidActionRenewPostRequestbodyContentApplicationJsonSchema body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VM/(?<vmGUID>[^/]+)/Action/Renew$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VM/{vmGUID}/Action/Renew'"); } // replace URI parameters with values from identity var vmGuid = _match.Groups["vmGUID"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + vmGuid + "/Action/Renew" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PostVMActionRenewWithResult_Call (request, eventListener,sender); } } /// <summary>Renew the VM with the provided timestamp.</summary> /// <param name="vmGuid">GUID of the Provisioned VM</param> /// <param name="body">The renewal timestamp has to be provided in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PostVMActionRenewWithResult(string vmGuid, Commvault.Powershell.Models.IPaths1C2BvcjV4VMVmguidActionRenewPostRequestbodyContentApplicationJsonSchema body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + global::System.Uri.EscapeDataString(vmGuid) + "/Action/Renew" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PostVMActionRenewWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PostVMActionRenewWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PostVMActionRenewWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PostVMActionRenew" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PostVMActionRenew_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PostVMActionRenew" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="vmGuid">GUID of the Provisioned VM</param> /// <param name="body">The renewal timestamp has to be provided in unix format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PostVMActionRenew_Validate(string vmGuid, Commvault.Powershell.Models.IPaths1C2BvcjV4VMVmguidActionRenewPostRequestbodyContentApplicationJsonSchema body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(vmGuid),vmGuid); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to preview application content</summary> /// <param name="clusterId">clusterId of the Kubernetes client to do a Preview</param> /// <param name="body">Application Group Preview Request</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PreviewApplicationGroup(long clusterId, Commvault.Powershell.Models.IKubernetesApplicationGroupPreviewReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesApplicationGroupPreviewResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/Preview" + "?" + "clusterId=" + global::System.Uri.EscapeDataString(clusterId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PreviewApplicationGroup_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>API to preview application content</summary> /// <param name="viaIdentity"></param> /// <param name="clusterId">clusterId of the Kubernetes client to do a Preview</param> /// <param name="body">Application Group Preview Request</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PreviewApplicationGroupViaIdentity(global::System.String viaIdentity, long clusterId, Commvault.Powershell.Models.IKubernetesApplicationGroupPreviewReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesApplicationGroupPreviewResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/ApplicationGroup/Preview$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/ApplicationGroup/Preview'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/Preview" + "?" + "clusterId=" + global::System.Uri.EscapeDataString(clusterId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PreviewApplicationGroup_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PreviewApplicationGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PreviewApplicationGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IKubernetesApplicationGroupPreviewResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.KubernetesApplicationGroupPreviewResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PreviewApplicationGroup" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="clusterId">clusterId of the Kubernetes client to do a Preview</param> /// <param name="body">Application Group Preview Request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PreviewApplicationGroup_Validate(long clusterId, Commvault.Powershell.Models.IKubernetesApplicationGroupPreviewReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Put owner permissions and/or automatic laptop ownership assignment</summary> /// <param name="body">Owner permissions and laptop ownership details</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutAccessControl(Commvault.Powershell.Models.IAccessControl body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AccessControl" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutAccessControl_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Put owner permissions and/or automatic laptop ownership assignment</summary> /// <param name="body">Owner permissions and laptop ownership details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutAccessControlWithResult(Commvault.Powershell.Models.IAccessControl body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/AccessControl" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PutAccessControlWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PutAccessControlWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutAccessControlWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PutAccessControl" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutAccessControl_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PutAccessControl" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Owner permissions and laptop ownership details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutAccessControl_Validate(Commvault.Powershell.Models.IAccessControl body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to update existing laptop owner mapping</summary> /// <param name="body">List of laptop owner mappings to update.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutLaptopOwnerMapping(Commvault.Powershell.Models.ILaptopOwnerMapping body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopOwnerMapping" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutLaptopOwnerMapping_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary> /// API to assign users specified in device owner mapping as owners of laptops presented in the request body. /// </summary> /// <param name="companyId">Id of the company that this operation will be performed for</param> /// <param name="body">Assign owners to laptops in the request.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutLaptopOwnerMappingActionAssign(long? companyId, Commvault.Powershell.Models.IAssignLaptopOwnerMappingReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopOwnerMapping/action/Assign" + "?" + (null == companyId ? global::System.String.Empty : "companyId=" + global::System.Uri.EscapeDataString(companyId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutLaptopOwnerMappingActionAssign_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary> /// API to assign users specified in device owner mapping as owners of laptops presented in the request body. /// </summary> /// <param name="viaIdentity"></param> /// <param name="companyId">Id of the company that this operation will be performed for</param> /// <param name="body">Assign owners to laptops in the request.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutLaptopOwnerMappingActionAssignViaIdentity(global::System.String viaIdentity, long? companyId, Commvault.Powershell.Models.IAssignLaptopOwnerMappingReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopOwnerMapping/action/Assign$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopOwnerMapping/action/Assign'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopOwnerMapping/action/Assign" + "?" + (null == companyId ? global::System.String.Empty : "companyId=" + global::System.Uri.EscapeDataString(companyId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutLaptopOwnerMappingActionAssign_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary> /// API to assign users specified in device owner mapping as owners of laptops presented in the request body. /// </summary> /// <param name="viaIdentity"></param> /// <param name="companyId">Id of the company that this operation will be performed for</param> /// <param name="body">Assign owners to laptops in the request.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutLaptopOwnerMappingActionAssignViaIdentityWithResult(global::System.String viaIdentity, long? companyId, Commvault.Powershell.Models.IAssignLaptopOwnerMappingReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopOwnerMapping/action/Assign$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopOwnerMapping/action/Assign'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopOwnerMapping/action/Assign" + "?" + (null == companyId ? global::System.String.Empty : "companyId=" + global::System.Uri.EscapeDataString(companyId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PutLaptopOwnerMappingActionAssignWithResult_Call (request, eventListener,sender); } } /// <summary> /// API to assign users specified in device owner mapping as owners of laptops presented in the request body. /// </summary> /// <param name="companyId">Id of the company that this operation will be performed for</param> /// <param name="body">Assign owners to laptops in the request.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutLaptopOwnerMappingActionAssignWithResult(long? companyId, Commvault.Powershell.Models.IAssignLaptopOwnerMappingReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopOwnerMapping/action/Assign" + "?" + (null == companyId ? global::System.String.Empty : "companyId=" + global::System.Uri.EscapeDataString(companyId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PutLaptopOwnerMappingActionAssignWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "PutLaptopOwnerMappingActionAssignWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutLaptopOwnerMappingActionAssignWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PutLaptopOwnerMappingActionAssign" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutLaptopOwnerMappingActionAssign_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PutLaptopOwnerMappingActionAssign" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="companyId">Id of the company that this operation will be performed for</param> /// <param name="body">Assign owners to laptops in the request.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutLaptopOwnerMappingActionAssign_Validate(long? companyId, Commvault.Powershell.Models.IAssignLaptopOwnerMappingReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to update existing laptop owner mapping</summary> /// <param name="body">List of laptop owner mappings to update.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutLaptopOwnerMappingWithResult(Commvault.Powershell.Models.ILaptopOwnerMapping body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopOwnerMapping" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PutLaptopOwnerMappingWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PutLaptopOwnerMappingWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutLaptopOwnerMappingWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PutLaptopOwnerMapping" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutLaptopOwnerMapping_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PutLaptopOwnerMapping" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">List of laptop owner mappings to update.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutLaptopOwnerMapping_Validate(Commvault.Powershell.Models.ILaptopOwnerMapping body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to send request to process plan rules against specific set of entities.</summary> /// <param name="body">Request body will consist of entities that are need to be evaluated against plan rules.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutPlanRuleAssociatedEntities(Commvault.Powershell.Models.IExecutePlanRules body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/Entities" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutPlanRuleAssociatedEntities_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>API to send request to process plan rules against specific set of entities.</summary> /// <param name="body">Request body will consist of entities that are need to be evaluated against plan rules.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutPlanRuleAssociatedEntitiesWithResult(Commvault.Powershell.Models.IExecutePlanRules body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/Entities" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PutPlanRuleAssociatedEntitiesWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "PutPlanRuleAssociatedEntitiesWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutPlanRuleAssociatedEntitiesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PutPlanRuleAssociatedEntities" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutPlanRuleAssociatedEntities_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PutPlanRuleAssociatedEntities" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="body">Request body will consist of entities that are need to be evaluated against plan rules.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutPlanRuleAssociatedEntities_Validate(Commvault.Powershell.Models.IExecutePlanRules body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to associate workloads to selected plan and plan rule</summary> /// <param name="body">List of entities that are will be associated to provided plan and said rule</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutPlanRuleEntitiesAssociate(Commvault.Powershell.Models.IAssociatePlanRuleEntityList body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/Entities/Associate" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutPlanRuleEntitiesAssociate_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PutPlanRuleEntitiesAssociate" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutPlanRuleEntitiesAssociate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PutPlanRuleEntitiesAssociate" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="body">List of entities that are will be associated to provided plan and said rule</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutPlanRuleEntitiesAssociate_Validate(Commvault.Powershell.Models.IAssociatePlanRuleEntityList body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to exclude workloads from plan rule evaluation framework</summary> /// <param name="body">Entities that need to be excluded from plan rule evaluation</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutPlanRuleEntitiesExclude(Commvault.Powershell.Models.IExcludeEntitiesFromPlanRuleEvaluation body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/Entities/Exclude" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutPlanRuleEntitiesExclude_Call (request, onOk,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>API to exclude workloads from plan rule evaluation framework</summary> /// <param name="body">Entities that need to be excluded from plan rule evaluation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutPlanRuleEntitiesExcludeWithResult(Commvault.Powershell.Models.IExcludeEntitiesFromPlanRuleEvaluation body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/Entities/Exclude" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PutPlanRuleEntitiesExcludeWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "PutPlanRuleEntitiesExcludeWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutPlanRuleEntitiesExcludeWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PutPlanRuleEntitiesExclude" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutPlanRuleEntitiesExclude_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PutPlanRuleEntitiesExclude" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="body">Entities that need to be excluded from plan rule evaluation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutPlanRuleEntitiesExclude_Validate(Commvault.Powershell.Models.IExcludeEntitiesFromPlanRuleEvaluation body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to include workloads to be applicable for plan rule evaluation.</summary> /// <param name="body">Entities that need to be included for plan rule evaluation</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutPlanRuleEntitiesInclude(Commvault.Powershell.Models.IIncludeEntitiesForPlanRuleEvaluation body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/Entities/Include" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutPlanRuleEntitiesInclude_Call (request, onOk,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>API to include workloads to be applicable for plan rule evaluation.</summary> /// <param name="body">Entities that need to be included for plan rule evaluation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutPlanRuleEntitiesIncludeWithResult(Commvault.Powershell.Models.IIncludeEntitiesForPlanRuleEvaluation body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/Entities/Include" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PutPlanRuleEntitiesIncludeWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "PutPlanRuleEntitiesIncludeWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutPlanRuleEntitiesIncludeWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PutPlanRuleEntitiesInclude" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutPlanRuleEntitiesInclude_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PutPlanRuleEntitiesInclude" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="body">Entities that need to be included for plan rule evaluation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutPlanRuleEntitiesInclude_Validate(Commvault.Powershell.Models.IIncludeEntitiesForPlanRuleEvaluation body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to set plan rule execution settings</summary> /// <param name="body">Message object to hold settings for plan rule execution.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutPlanRuleSettings(Commvault.Powershell.Models.IPlanRuleExecutionSettings body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onUnauthorized, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/Settings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutPlanRuleSettings_Call (request, onOk,onUnauthorized,onInternalServerError,eventListener,sender); } } /// <summary>API to set plan rule execution settings</summary> /// <param name="body">Message object to hold settings for plan rule execution.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutPlanRuleSettingsWithResult(Commvault.Powershell.Models.IPlanRuleExecutionSettings body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/Settings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PutPlanRuleSettingsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PutPlanRuleSettingsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutPlanRuleSettingsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PutPlanRuleSettings" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutPlanRuleSettings_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onUnauthorized, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onUnauthorized(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PutPlanRuleSettings" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Message object to hold settings for plan rule execution.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutPlanRuleSettings_Validate(Commvault.Powershell.Models.IPlanRuleExecutionSettings body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to associate data classification plan to servergroup</summary> /// <param name="serverGroupId"></param> /// <param name="body">DC Plan id and name</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutServerGroupDcPlan(long serverGroupId, Commvault.Powershell.Models.IIdName body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/DCPlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutServerGroupDcPlan_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>API to associate data classification plan to servergroup</summary> /// <param name="viaIdentity"></param> /// <param name="body">DC Plan id and name</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutServerGroupDcPlanViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IIdName body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/DCPlan$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/DCPlan'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/DCPlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutServerGroupDcPlan_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>API to associate data classification plan to servergroup</summary> /// <param name="viaIdentity"></param> /// <param name="body">DC Plan id and name</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutServerGroupDcPlanViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IIdName body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/DCPlan$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/DCPlan'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/DCPlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PutServerGroupDcPlanWithResult_Call (request, eventListener,sender); } } /// <summary>API to associate data classification plan to servergroup</summary> /// <param name="serverGroupId"></param> /// <param name="body">DC Plan id and name</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutServerGroupDcPlanWithResult(long serverGroupId, Commvault.Powershell.Models.IIdName body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/DCPlan" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PutServerGroupDcPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PutServerGroupDcPlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutServerGroupDcPlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PutServerGroupDcPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutServerGroupDcPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PutServerGroupDcPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="serverGroupId"></param> /// <param name="body">DC Plan id and name</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutServerGroupDcPlan_Validate(long serverGroupId, Commvault.Powershell.Models.IIdName body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify values for give tagId</summary> /// <param name="tagId">Id of the tag name whose value is requested</param> /// <param name="body">Request body to update tag values</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutValuesForTagId(long tagId, Commvault.Powershell.Models.IUpdateTagValueRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Tags/" + (tagId.ToString()) + "/Values" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutValuesForTagId_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Modify values for give tagId</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request body to update tag values</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutValuesForTagIdViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateTagValueRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Tags/(?<tagId>[^/]+)/Values$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Tags/{tagId}/Values'"); } // replace URI parameters with values from identity var tagId = _match.Groups["tagId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Tags/" + tagId + "/Values" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutValuesForTagId_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>Modify values for give tagId</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request body to update tag values</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutValuesForTagIdViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateTagValueRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Tags/(?<tagId>[^/]+)/Values$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Tags/{tagId}/Values'"); } // replace URI parameters with values from identity var tagId = _match.Groups["tagId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Tags/" + tagId + "/Values" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PutValuesForTagIdWithResult_Call (request, eventListener,sender); } } /// <summary>Modify values for give tagId</summary> /// <param name="tagId">Id of the tag name whose value is requested</param> /// <param name="body">Request body to update tag values</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutValuesForTagIdWithResult(long tagId, Commvault.Powershell.Models.IUpdateTagValueRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Tags/" + (tagId.ToString()) + "/Values" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PutValuesForTagIdWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PutValuesForTagIdWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutValuesForTagIdWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PutValuesForTagId" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutValuesForTagId_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PutValuesForTagId" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="tagId">Id of the tag name whose value is requested</param> /// <param name="body">Request body to update tag values</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutValuesForTagId_Validate(long tagId, Commvault.Powershell.Models.IUpdateTagValueRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>This endpoint is used to edit network topology.</summary> /// <param name="topologyId"></param> /// <param name="body">FirewallTopologyReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutfirewallTopology(string topologyId, Commvault.Powershell.Models.IFirewallTopologyCreateReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology/" + global::System.Uri.EscapeDataString(topologyId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutfirewallTopology_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>This endpoint is used to edit network topology.</summary> /// <param name="viaIdentity"></param> /// <param name="body">FirewallTopologyReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task PutfirewallTopologyViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IFirewallTopologyCreateReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/NetworkTopology/(?<topologyId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/NetworkTopology/{topologyId}'"); } // replace URI parameters with values from identity var topologyId = _match.Groups["topologyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology/" + topologyId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.PutfirewallTopology_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>This endpoint is used to edit network topology.</summary> /// <param name="viaIdentity"></param> /// <param name="body">FirewallTopologyReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutfirewallTopologyViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IFirewallTopologyCreateReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/NetworkTopology/(?<topologyId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/NetworkTopology/{topologyId}'"); } // replace URI parameters with values from identity var topologyId = _match.Groups["topologyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology/" + topologyId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PutfirewallTopologyWithResult_Call (request, eventListener,sender); } } /// <summary>This endpoint is used to edit network topology.</summary> /// <param name="topologyId"></param> /// <param name="body">FirewallTopologyReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutfirewallTopologyWithResult(string topologyId, Commvault.Powershell.Models.IFirewallTopologyCreateReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/NetworkTopology/" + global::System.Uri.EscapeDataString(topologyId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.PutfirewallTopologyWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "PutfirewallTopologyWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> PutfirewallTopologyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "PutfirewallTopology" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutfirewallTopology_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="PutfirewallTopology" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="topologyId"></param> /// <param name="body">FirewallTopologyReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task PutfirewallTopology_Validate(string topologyId, Commvault.Powershell.Models.IFirewallTopologyCreateReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(topologyId),topologyId); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>REconfigures and Renew License for the hypervisor client</summary> /// <param name="hypervisorId">Hypervisor client ID to reconfigure</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ReConfigureHypervisor(long hypervisorId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + (hypervisorId.ToString()) + "/Reconfigure" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ReConfigureHypervisor_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>REconfigures and Renew License for the hypervisor client</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ReConfigureHypervisorViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Hypervisor/(?<hypervisorId>[^/]+)/Reconfigure$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Hypervisor/{hypervisorId}/Reconfigure'"); } // replace URI parameters with values from identity var hypervisorId = _match.Groups["hypervisorId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + hypervisorId + "/Reconfigure" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ReConfigureHypervisor_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>REconfigures and Renew License for the hypervisor client</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ReConfigureHypervisorViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Hypervisor/(?<hypervisorId>[^/]+)/Reconfigure$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Hypervisor/{hypervisorId}/Reconfigure'"); } // replace URI parameters with values from identity var hypervisorId = _match.Groups["hypervisorId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + hypervisorId + "/Reconfigure" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ReConfigureHypervisorWithResult_Call (request, eventListener,sender); } } /// <summary>REconfigures and Renew License for the hypervisor client</summary> /// <param name="hypervisorId">Hypervisor client ID to reconfigure</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ReConfigureHypervisorWithResult(long hypervisorId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + (hypervisorId.ToString()) + "/Reconfigure" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ReConfigureHypervisorWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ReConfigureHypervisorWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ReConfigureHypervisorWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "ReConfigureHypervisor" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ReConfigureHypervisor_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ReConfigureHypervisor" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="hypervisorId">Hypervisor client ID to reconfigure</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ReConfigureHypervisor_Validate(long hypervisorId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Mark a triggered alert as read</summary> /// <param name="id"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ReadTriggeredAlerts(long id, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + (id.ToString()) + "/Read" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ReadTriggeredAlerts_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Mark a triggered alert as read</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ReadTriggeredAlertsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/TriggeredAlerts/(?<id>[^/]+)/Read$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/TriggeredAlerts/{id}/Read'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + id + "/Read" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ReadTriggeredAlerts_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Mark a triggered alert as read</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ReadTriggeredAlertsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/TriggeredAlerts/(?<id>[^/]+)/Read$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/TriggeredAlerts/{id}/Read'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + id + "/Read" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ReadTriggeredAlertsWithResult_Call (request, eventListener,sender); } } /// <summary>Mark a triggered alert as read</summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ReadTriggeredAlertsWithResult(long id, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + (id.ToString()) + "/Read" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ReadTriggeredAlertsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ReadTriggeredAlertsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ReadTriggeredAlertsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "ReadTriggeredAlerts" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ReadTriggeredAlerts_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ReadTriggeredAlerts" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ReadTriggeredAlerts_Validate(long id, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to reconfigure a Kubernetes cluster with clusterId</summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ReconfigureKubernetesCluster(long clusterId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + (clusterId.ToString()) + "/Reconfigure" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ReconfigureKubernetesCluster_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to reconfigure a Kubernetes cluster with clusterId</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ReconfigureKubernetesClusterViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Cluster/(?<clusterId>[^/]+)/Reconfigure$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Cluster/{clusterId}/Reconfigure'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + clusterId + "/Reconfigure" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ReconfigureKubernetesCluster_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ReconfigureKubernetesCluster" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ReconfigureKubernetesCluster_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericRespWithWarning.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ReconfigureKubernetesCluster" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ReconfigureKubernetesCluster_Validate(long clusterId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Refresh a specific node of HyperScale</summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="nodeId">Id of node</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RefreshNodeOfHyperScaleStorage(long hyperScaleStorageId, long nodeId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + (hyperScaleStorageId.ToString()) + "/Node/" + (nodeId.ToString()) + "/Refresh" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RefreshNodeOfHyperScaleStorage_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Refresh a specific node of HyperScale</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RefreshNodeOfHyperScaleStorageViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/HyperScale/(?<hyperScaleStorageId>[^/]+)/Node/(?<nodeId>[^/]+)/Refresh$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/HyperScale/{hyperScaleStorageId}/Node/{nodeId}/Refresh'"); } // replace URI parameters with values from identity var hyperScaleStorageId = _match.Groups["hyperScaleStorageId"].Value; var nodeId = _match.Groups["nodeId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + hyperScaleStorageId + "/Node/" + nodeId + "/Refresh" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RefreshNodeOfHyperScaleStorage_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Refresh a specific node of HyperScale</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> RefreshNodeOfHyperScaleStorageViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/HyperScale/(?<hyperScaleStorageId>[^/]+)/Node/(?<nodeId>[^/]+)/Refresh$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/HyperScale/{hyperScaleStorageId}/Node/{nodeId}/Refresh'"); } // replace URI parameters with values from identity var hyperScaleStorageId = _match.Groups["hyperScaleStorageId"].Value; var nodeId = _match.Groups["nodeId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + hyperScaleStorageId + "/Node/" + nodeId + "/Refresh" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RefreshNodeOfHyperScaleStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Refresh a specific node of HyperScale</summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="nodeId">Id of node</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> RefreshNodeOfHyperScaleStorageWithResult(long hyperScaleStorageId, long nodeId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + (hyperScaleStorageId.ToString()) + "/Node/" + (nodeId.ToString()) + "/Refresh" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RefreshNodeOfHyperScaleStorageWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "RefreshNodeOfHyperScaleStorageWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> RefreshNodeOfHyperScaleStorageWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "RefreshNodeOfHyperScaleStorage" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RefreshNodeOfHyperScaleStorage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RefreshNodeOfHyperScaleStorage" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="nodeId">Id of node</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RefreshNodeOfHyperScaleStorage_Validate(long hyperScaleStorageId, long nodeId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Used to immediately refresh automatic server associations for a server group</summary> /// <param name="serverGroupId">Id of the serverGroup whose associations has to be refreshed</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RefreshServerGroupAssociation(long serverGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/Refresh" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RefreshServerGroupAssociation_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Used to immediately refresh automatic server associations for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RefreshServerGroupAssociationViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/Refresh$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/Refresh'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/Refresh" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RefreshServerGroupAssociation_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Used to immediately refresh automatic server associations for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> RefreshServerGroupAssociationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/Refresh$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/Refresh'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/Refresh" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RefreshServerGroupAssociationWithResult_Call (request, eventListener,sender); } } /// <summary>Used to immediately refresh automatic server associations for a server group</summary> /// <param name="serverGroupId">Id of the serverGroup whose associations has to be refreshed</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> RefreshServerGroupAssociationWithResult(long serverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/Refresh" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RefreshServerGroupAssociationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "RefreshServerGroupAssociationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> RefreshServerGroupAssociationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "RefreshServerGroupAssociation" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RefreshServerGroupAssociation_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RefreshServerGroupAssociation" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="serverGroupId">Id of the serverGroup whose associations has to be refreshed</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RefreshServerGroupAssociation_Validate(long serverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Repair software for client and clients for the given client group(s).</summary> /// <param name="body">Request body for server and server group repair software</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RepairSoftware(Commvault.Powershell.Models.IRepairSoftware body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RepairSoftware" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RepairSoftware_Call (request, onOk,eventListener,sender); } } /// <summary>Repair software for client and clients for the given client group(s).</summary> /// <param name="body">Request body for server and server group repair software</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse> RepairSoftwareWithResult(Commvault.Powershell.Models.IRepairSoftware body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RepairSoftware" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RepairSoftwareWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "RepairSoftwareWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse> RepairSoftwareWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.JobIdResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "RepairSoftware" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RepairSoftware_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.JobIdResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RepairSoftware" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Request body for server and server group repair software</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RepairSoftware_Validate(Commvault.Powershell.Models.IRepairSoftware body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Retrieves the list of Requests</summary> /// <param name="createdFrom">Source application of the request</param> /// <param name="sourceEntityType">Entity type of the source from which data is gathered for the request</param> /// <param name="sourceEntityId">Entity id of the source from which data is gathered for the request</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RequestManagerRequestList(string createdFrom, string sourceEntityType, long? sourceEntityId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRmRequestList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request" + "?" + (string.IsNullOrEmpty(createdFrom) ? global::System.String.Empty : "createdFrom=" + global::System.Uri.EscapeDataString(createdFrom)) + "&" + (string.IsNullOrEmpty(sourceEntityType) ? global::System.String.Empty : "sourceEntityType=" + global::System.Uri.EscapeDataString(sourceEntityType)) + "&" + (null == sourceEntityId ? global::System.String.Empty : "sourceEntityId=" + global::System.Uri.EscapeDataString(sourceEntityId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RequestManagerRequestList_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Retrieves the list of Requests</summary> /// <param name="viaIdentity"></param> /// <param name="createdFrom">Source application of the request</param> /// <param name="sourceEntityType">Entity type of the source from which data is gathered for the request</param> /// <param name="sourceEntityId">Entity id of the source from which data is gathered for the request</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RequestManagerRequestListViaIdentity(global::System.String viaIdentity, string createdFrom, string sourceEntityType, long? sourceEntityId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRmRequestList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/RequestManager/Request$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/RequestManager/Request'"); } // replace URI parameters with values from identity // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request" + "?" + (string.IsNullOrEmpty(createdFrom) ? global::System.String.Empty : "createdFrom=" + global::System.Uri.EscapeDataString(createdFrom)) + "&" + (string.IsNullOrEmpty(sourceEntityType) ? global::System.String.Empty : "sourceEntityType=" + global::System.Uri.EscapeDataString(sourceEntityType)) + "&" + (null == sourceEntityId ? global::System.String.Empty : "sourceEntityId=" + global::System.Uri.EscapeDataString(sourceEntityId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RequestManagerRequestList_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "RequestManagerRequestList" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RequestManagerRequestList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRmRequestList>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RmRequestList.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RequestManagerRequestList" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="createdFrom">Source application of the request</param> /// <param name="sourceEntityType">Entity type of the source from which data is gathered for the request</param> /// <param name="sourceEntityId">Entity id of the source from which data is gathered for the request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RequestManagerRequestList_Validate(string createdFrom, string sourceEntityType, long? sourceEntityId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(createdFrom),createdFrom); await eventListener.AssertNotNull(nameof(sourceEntityType),sourceEntityType); } } /// <summary>Selectively uninstall packages from given client</summary> /// <param name="clientId"></param> /// <param name="body">RetireClientRequest</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RetireClientPackages(long clientId, Commvault.Powershell.Models.IRetireClientRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireClientResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Client/" + (clientId.ToString()) + "/Retire" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RetireClientPackages_Call (request, onOk,eventListener,sender); } } /// <summary>Selectively uninstall packages from given client</summary> /// <param name="viaIdentity"></param> /// <param name="body">RetireClientRequest</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RetireClientPackagesViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IRetireClientRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireClientResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Client/(?<clientId>[^/]+)/Retire$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Client/{clientId}/Retire'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Client/" + clientId + "/Retire" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RetireClientPackages_Call (request, onOk,eventListener,sender); } } /// <summary>Selectively uninstall packages from given client</summary> /// <param name="viaIdentity"></param> /// <param name="body">RetireClientRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireClientResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireClientResponse> RetireClientPackagesViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IRetireClientRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Client/(?<clientId>[^/]+)/Retire$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Client/{clientId}/Retire'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Client/" + clientId + "/Retire" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RetireClientPackagesWithResult_Call (request, eventListener,sender); } } /// <summary>Selectively uninstall packages from given client</summary> /// <param name="clientId"></param> /// <param name="body">RetireClientRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireClientResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireClientResponse> RetireClientPackagesWithResult(long clientId, Commvault.Powershell.Models.IRetireClientRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Client/" + (clientId.ToString()) + "/Retire" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RetireClientPackagesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "RetireClientPackagesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireClientResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireClientResponse> RetireClientPackagesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RetireClientResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "RetireClientPackages" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RetireClientPackages_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireClientResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RetireClientResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RetireClientPackages" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="clientId"></param> /// <param name="body">RetireClientRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RetireClientPackages_Validate(long clientId, Commvault.Powershell.Models.IRetireClientRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to retire a Kubernetes cluster with clusterId</summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RetireKubernetesCluster(long clusterId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + (clusterId.ToString()) + "/Retire" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RetireKubernetesCluster_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to retire a Kubernetes cluster with clusterId</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RetireKubernetesClusterViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Cluster/(?<clusterId>[^/]+)/Retire$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Cluster/{clusterId}/Retire'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + clusterId + "/Retire" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RetireKubernetesCluster_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to retire a Kubernetes cluster with clusterId</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> RetireKubernetesClusterViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Cluster/(?<clusterId>[^/]+)/Retire$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Cluster/{clusterId}/Retire'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + clusterId + "/Retire" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RetireKubernetesClusterWithResult_Call (request, eventListener,sender); } } /// <summary>API to retire a Kubernetes cluster with clusterId</summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> RetireKubernetesClusterWithResult(long clusterId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + (clusterId.ToString()) + "/Retire" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Delete, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RetireKubernetesClusterWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "RetireKubernetesClusterWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> RetireKubernetesClusterWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "RetireKubernetesCluster" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RetireKubernetesCluster_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RetireKubernetesCluster" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RetireKubernetesCluster_Validate(long clusterId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Retire servers in given server group</summary> /// <param name="serverGroupId">Id of the serverGroup in which servers need to be retired</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RetireServerGroup(long serverGroupId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServerGroupResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/Retire" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RetireServerGroup_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Retire servers in given server group</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RetireServerGroupViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServerGroupResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/Retire$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/Retire'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/Retire" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RetireServerGroup_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Retire servers in given server group</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServerGroupResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServerGroupResp> RetireServerGroupViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)/Retire$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}/Retire'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId + "/Retire" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RetireServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Retire servers in given server group</summary> /// <param name="serverGroupId">Id of the serverGroup in which servers need to be retired</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServerGroupResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServerGroupResp> RetireServerGroupWithResult(long serverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) + "/Retire" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RetireServerGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "RetireServerGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServerGroupResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServerGroupResp> RetireServerGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RetireServerGroupResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "RetireServerGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RetireServerGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServerGroupResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RetireServerGroupResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RetireServerGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="serverGroupId">Id of the serverGroup in which servers need to be retired</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RetireServerGroup_Validate(long serverGroupId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Retire multiple servers</summary> /// <param name="body">RetireServersRequest</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RetireServers(Commvault.Powershell.Models.IRetireServersRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServersResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Servers/Retire" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RetireServers_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Retire multiple servers</summary> /// <param name="body">RetireServersRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServersResponse>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServersResponse> RetireServersWithResult(Commvault.Powershell.Models.IRetireServersRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Servers/Retire" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RetireServersWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "RetireServersWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServersResponse>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServersResponse> RetireServersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RetireServersResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "RetireServers" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RetireServers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IRetireServersResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.RetireServersResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RetireServers" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">RetireServersRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RetireServers_Validate(Commvault.Powershell.Models.IRetireServersRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>This endpoint is used to return the details of Drive Pool.</summary> /// <param name="libraryId">Id of the Tape of which the drive details has to be displayed</param> /// <param name="driveId">Id of the Drive of which the drive details has to be displayed</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ReturnDrivePoolDetails(long libraryId, long driveId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDrivePoolDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + (libraryId.ToString()) + "/Drive/" + (driveId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ReturnDrivePoolDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>This endpoint is used to return the details of Drive Pool.</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ReturnDrivePoolDetailsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDrivePoolDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Tape/(?<libraryId>[^/]+)/Drive/(?<driveId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Tape/{libraryId}/Drive/{driveId}'"); } // replace URI parameters with values from identity var libraryId = _match.Groups["libraryId"].Value; var driveId = _match.Groups["driveId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/" + libraryId + "/Drive/" + driveId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ReturnDrivePoolDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ReturnDrivePoolDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ReturnDrivePoolDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IDrivePoolDetailsResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.DrivePoolDetailsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ReturnDrivePoolDetails" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="libraryId">Id of the Tape of which the drive details has to be displayed</param> /// <param name="driveId">Id of the Drive of which the drive details has to be displayed</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ReturnDrivePoolDetails_Validate(long libraryId, long driveId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ReturnListOfLocations(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocationListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape/Locations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ReturnListOfLocations_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ReturnListOfLocations" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ReturnListOfLocations_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ILocationListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.LocationListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ReturnListOfLocations" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ReturnListOfLocations_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>This endpoint is used to return the list of tape storages.</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ReturnListOfTapes(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITapeListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ReturnListOfTapes_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>This endpoint is used to return the list of tape storages.</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITapeListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITapeListResp> ReturnListOfTapesWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Tape" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ReturnListOfTapesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ReturnListOfTapesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITapeListResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITapeListResp> ReturnListOfTapesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.TapeListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "ReturnListOfTapes" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ReturnListOfTapes_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ITapeListResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.TapeListResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ReturnListOfTapes" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ReturnListOfTapes_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Configure a created request</summary> /// <param name="requestId"></param> /// <param name="body">RMConfigureRequest</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RmconfigureRequestOperation(long requestId, Commvault.Powershell.Models.IRmConfigureRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request/" + (requestId.ToString()) + "/Configure" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RmconfigureRequestOperation_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Configure a created request</summary> /// <param name="viaIdentity"></param> /// <param name="body">RMConfigureRequest</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RmconfigureRequestOperationViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IRmConfigureRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/RequestManager/Request/(?<requestId>[^/]+)/Configure$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/RequestManager/Request/{requestId}/Configure'"); } // replace URI parameters with values from identity var requestId = _match.Groups["requestId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request/" + requestId + "/Configure" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RmconfigureRequestOperation_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Configure a created request</summary> /// <param name="viaIdentity"></param> /// <param name="body">RMConfigureRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> RmconfigureRequestOperationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IRmConfigureRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/RequestManager/Request/(?<requestId>[^/]+)/Configure$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/RequestManager/Request/{requestId}/Configure'"); } // replace URI parameters with values from identity var requestId = _match.Groups["requestId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request/" + requestId + "/Configure" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RmconfigureRequestOperationWithResult_Call (request, eventListener,sender); } } /// <summary>Configure a created request</summary> /// <param name="requestId"></param> /// <param name="body">RMConfigureRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> RmconfigureRequestOperationWithResult(long requestId, Commvault.Powershell.Models.IRmConfigureRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request/" + (requestId.ToString()) + "/Configure" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RmconfigureRequestOperationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "RmconfigureRequestOperationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> RmconfigureRequestOperationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "RmconfigureRequestOperation" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RmconfigureRequestOperation_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RmconfigureRequestOperation" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="requestId"></param> /// <param name="body">RMConfigureRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RmconfigureRequestOperation_Validate(long requestId, Commvault.Powershell.Models.IRmConfigureRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Creating a request for request manager</summary> /// <param name="body">RMCreateRequest</param> /// <param name="onCreated">a delegate that is called when the remote service returns 201 (Created).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RmcreateRequestOperation(Commvault.Powershell.Models.IRmCreateRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onCreated, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/RequestManager/Request" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RmcreateRequestOperation_Call (request, onCreated,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "RmcreateRequestOperation" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onCreated">a delegate that is called when the remote service returns 201 (Created).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RmcreateRequestOperation_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IIdName>, global::System.Threading.Tasks.Task> onCreated, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.Created: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.IdName.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RmcreateRequestOperation" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="body">RMCreateRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RmcreateRequestOperation_Validate(Commvault.Powershell.Models.IRmCreateRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>rotates the S3AccessKey for the logged in user</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RotateS3AccessKey(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/User/S3AccessKey" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RotateS3AccessKey_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>rotates the S3AccessKey for the logged in user</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> RotateS3AccessKeyWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/User/S3AccessKey" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RotateS3AccessKeyWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "RotateS3AccessKeyWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> RotateS3AccessKeyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "RotateS3AccessKey" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RotateS3AccessKey_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RotateS3AccessKey" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RotateS3AccessKey_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Rotate the S3AccessKey for the given User Id</summary> /// <param name="id">ID of the user</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RotateUserS3AccessKey(long id, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/User/" + (id.ToString()) + "/S3AccessKey" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RotateUserS3AccessKey_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Rotate the S3AccessKey for the given User Id</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RotateUserS3AccessKeyViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/User/(?<id>[^/]+)/S3AccessKey$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/User/{id}/S3AccessKey'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/User/" + id + "/S3AccessKey" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RotateUserS3AccessKey_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Rotate the S3AccessKey for the given User Id</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> RotateUserS3AccessKeyViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/User/(?<id>[^/]+)/S3AccessKey$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/User/{id}/S3AccessKey'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/User/" + id + "/S3AccessKey" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RotateUserS3AccessKeyWithResult_Call (request, eventListener,sender); } } /// <summary>Rotate the S3AccessKey for the given User Id</summary> /// <param name="id">ID of the user</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> RotateUserS3AccessKeyWithResult(long id, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/User/" + (id.ToString()) + "/S3AccessKey" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RotateUserS3AccessKeyWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "RotateUserS3AccessKeyWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> RotateUserS3AccessKeyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "RotateUserS3AccessKey" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RotateUserS3AccessKey_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RotateUserS3AccessKey" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id">ID of the user</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RotateUserS3AccessKey_Validate(long id, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>API to run backup for an application</summary> /// <param name="appGuid">GUID of the Application to run backup for</param> /// <param name="backupLevel">Backup level , Default :Incremental</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RunApplicationBackup(string appGuid, string backupLevel, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Application/" + global::System.Uri.EscapeDataString(appGuid) + "/Backup" + "?" + (string.IsNullOrEmpty(backupLevel) ? global::System.String.Empty : "backupLevel=" + global::System.Uri.EscapeDataString(backupLevel)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RunApplicationBackup_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to run backup for an application</summary> /// <param name="viaIdentity"></param> /// <param name="backupLevel">Backup level , Default :Incremental</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RunApplicationBackupViaIdentity(global::System.String viaIdentity, string backupLevel, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Application/(?<appGUID>[^/]+)/Backup$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Application/{appGUID}/Backup'"); } // replace URI parameters with values from identity var appGuid = _match.Groups["appGUID"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Application/" + appGuid + "/Backup" + "?" + (string.IsNullOrEmpty(backupLevel) ? global::System.String.Empty : "backupLevel=" + global::System.Uri.EscapeDataString(backupLevel)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RunApplicationBackup_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "RunApplicationBackup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RunApplicationBackup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RunApplicationBackup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="appGuid">GUID of the Application to run backup for</param> /// <param name="backupLevel">Backup level , Default :Incremental</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RunApplicationBackup_Validate(string appGuid, string backupLevel, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(appGuid),appGuid); await eventListener.AssertNotNull(nameof(backupLevel),backupLevel); } } /// <summary>API to run backup for an application group</summary> /// <param name="applicationGroupId">applicationGroupId is the ID of the Kubernetes application group</param> /// <param name="backupLevel">Backup level , Default :Incremental</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RunApplicationGroupBackup(long applicationGroupId, string backupLevel, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + (applicationGroupId.ToString()) + "/Backup" + "?" + (string.IsNullOrEmpty(backupLevel) ? global::System.String.Empty : "backupLevel=" + global::System.Uri.EscapeDataString(backupLevel)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RunApplicationGroupBackup_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to run backup for an application group</summary> /// <param name="viaIdentity"></param> /// <param name="backupLevel">Backup level , Default :Incremental</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RunApplicationGroupBackupViaIdentity(global::System.String viaIdentity, string backupLevel, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/ApplicationGroup/(?<applicationGroupId>[^/]+)/Backup$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/ApplicationGroup/{applicationGroupId}/Backup'"); } // replace URI parameters with values from identity var applicationGroupId = _match.Groups["applicationGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + applicationGroupId + "/Backup" + "?" + (string.IsNullOrEmpty(backupLevel) ? global::System.String.Empty : "backupLevel=" + global::System.Uri.EscapeDataString(backupLevel)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RunApplicationGroupBackup_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "RunApplicationGroupBackup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RunApplicationGroupBackup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RunApplicationGroupBackup" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="applicationGroupId">applicationGroupId is the ID of the Kubernetes application group</param> /// <param name="backupLevel">Backup level , Default :Incremental</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RunApplicationGroupBackup_Validate(long applicationGroupId, string backupLevel, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(backupLevel),backupLevel); } } /// <summary>Run aux copy job for backup destination(s) of a plan.</summary> /// <param name="planId">Id of the Plan</param> /// <param name="backupDestinationId">Id of Backup Destination.</param> /// <param name="includeAllCopies">Primary backupDestinationId can be passed in backupDestinationId Path param when includeAllCopies /// is set to true, this will trigger the aux copy on all supported backup destinations of a region</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RunAuxCopyForPlan(long planId, long backupDestinationId, bool? includeAllCopies, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) + "/AuxCopy/Run" + "?" + (null == includeAllCopies ? global::System.String.Empty : "includeAllCopies=" + global::System.Uri.EscapeDataString(includeAllCopies.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RunAuxCopyForPlan_Call (request, onOk,eventListener,sender); } } /// <summary>Run aux copy job for backup destination(s) of a plan.</summary> /// <param name="viaIdentity"></param> /// <param name="includeAllCopies">Primary backupDestinationId can be passed in backupDestinationId Path param when includeAllCopies /// is set to true, this will trigger the aux copy on all supported backup destinations of a region</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RunAuxCopyForPlanViaIdentity(global::System.String viaIdentity, bool? includeAllCopies, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/(?<planId>[^/]+)/BackupDestination/(?<backupDestinationId>[^/]+)/AuxCopy/Run$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/{planId}/BackupDestination/{backupDestinationId}/AuxCopy/Run'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["backupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + planId + "/BackupDestination/" + backupDestinationId + "/AuxCopy/Run" + "?" + (null == includeAllCopies ? global::System.String.Empty : "includeAllCopies=" + global::System.Uri.EscapeDataString(includeAllCopies.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RunAuxCopyForPlan_Call (request, onOk,eventListener,sender); } } /// <summary>Run aux copy job for backup destination(s) of a plan.</summary> /// <param name="viaIdentity"></param> /// <param name="includeAllCopies">Primary backupDestinationId can be passed in backupDestinationId Path param when includeAllCopies /// is set to true, this will trigger the aux copy on all supported backup destinations of a region</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup> RunAuxCopyForPlanViaIdentityWithResult(global::System.String viaIdentity, bool? includeAllCopies, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/(?<planId>[^/]+)/BackupDestination/(?<backupDestinationId>[^/]+)/AuxCopy/Run$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/{planId}/BackupDestination/{backupDestinationId}/AuxCopy/Run'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["backupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + planId + "/BackupDestination/" + backupDestinationId + "/AuxCopy/Run" + "?" + (null == includeAllCopies ? global::System.String.Empty : "includeAllCopies=" + global::System.Uri.EscapeDataString(includeAllCopies.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RunAuxCopyForPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Run aux copy job for backup destination(s) of a plan.</summary> /// <param name="planId">Id of the Plan</param> /// <param name="backupDestinationId">Id of Backup Destination.</param> /// <param name="includeAllCopies">Primary backupDestinationId can be passed in backupDestinationId Path param when includeAllCopies /// is set to true, this will trigger the aux copy on all supported backup destinations of a region</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup> RunAuxCopyForPlanWithResult(long planId, long backupDestinationId, bool? includeAllCopies, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) + "/AuxCopy/Run" + "?" + (null == includeAllCopies ? global::System.String.Empty : "includeAllCopies=" + global::System.Uri.EscapeDataString(includeAllCopies.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.RunAuxCopyForPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "RunAuxCopyForPlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup> RunAuxCopyForPlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "RunAuxCopyForPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RunAuxCopyForPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RunAuxCopyForPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the Plan</param> /// <param name="backupDestinationId">Id of Backup Destination.</param> /// <param name="includeAllCopies">Primary backupDestinationId can be passed in backupDestinationId Path param when includeAllCopies /// is set to true, this will trigger the aux copy on all supported backup destinations of a region</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RunAuxCopyForPlan_Validate(long planId, long backupDestinationId, bool? includeAllCopies, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Run Backup copy job for a backupdestination</summary> /// <param name="planId"></param> /// <param name="backupDestionationId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RunBackupCopy(long planId, long backupDestionationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestionationId.ToString()) + "/BackupCopy/Run" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RunBackupCopy_Call (request, onOk,onConflict,onInternalServerError,eventListener,sender); } } /// <summary>Run Backup copy job for a backupdestination</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RunBackupCopyViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/(?<planId>[^/]+)/BackupDestination/(?<backupDestionationId>[^/]+)/BackupCopy/Run$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/{planId}/BackupDestination/{backupDestionationId}/BackupCopy/Run'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestionationId = _match.Groups["backupDestionationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + planId + "/BackupDestination/" + backupDestionationId + "/BackupCopy/Run" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RunBackupCopy_Call (request, onOk,onConflict,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "RunBackupCopy" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RunBackupCopy_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Conflict: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onConflict(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RunBackupCopy" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId"></param> /// <param name="backupDestionationId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RunBackupCopy_Validate(long planId, long backupDestionationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Run different job operations for a plan backup destination</summary> /// <param name="body">JobOperationOnCopyReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RunJobOperationOnPlanBackupDestination(Commvault.Powershell.Models.IJobOperationOnCopyReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobOperationOnCopyResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/JobOperations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RunJobOperationOnPlanBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "RunJobOperationOnPlanBackupDestination" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RunJobOperationOnPlanBackupDestination_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobOperationOnCopyResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.JobOperationOnCopyResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RunJobOperationOnPlanBackupDestination" /> method. Call this like the actual call, but /// you will get validation events back. /// </summary> /// <param name="body">JobOperationOnCopyReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RunJobOperationOnPlanBackupDestination_Validate(Commvault.Powershell.Models.IJobOperationOnCopyReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Run deferred snap catalog job for a backupdestination</summary> /// <param name="planId"></param> /// <param name="backupDestionationId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RunSnapCatalog(long planId, long backupDestionationId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestionationId.ToString()) + "/SnapCatalog/Run" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RunSnapCatalog_Call (request, onOk,onConflict,onInternalServerError,eventListener,sender); } } /// <summary>Run deferred snap catalog job for a backupdestination</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task RunSnapCatalogViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/(?<planId>[^/]+)/BackupDestination/(?<backupDestionationId>[^/]+)/SnapCatalog/Run$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/{planId}/BackupDestination/{backupDestionationId}/SnapCatalog/Run'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestionationId = _match.Groups["backupDestionationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + planId + "/BackupDestination/" + backupDestionationId + "/SnapCatalog/Run" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.RunSnapCatalog_Call (request, onOk,onConflict,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "RunSnapCatalog" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onConflict">a delegate that is called when the remote service returns 409 (Conflict).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RunSnapCatalog_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onConflict, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Conflict: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onConflict(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="RunSnapCatalog" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId"></param> /// <param name="backupDestionationId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task RunSnapCatalog_Validate(long planId, long backupDestionationId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>To test Email settings</summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SendTestMailReq(Commvault.Powershell.Models.ISendTestMailReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onUnauthorized, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EmailServer/Action/Test" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SendTestMailReq_Call (request, onOk,onBadRequest,onUnauthorized,eventListener,sender); } } /// <summary>To test Email settings</summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> SendTestMailReqWithResult(Commvault.Powershell.Models.ISendTestMailReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EmailServer/Action/Test" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SendTestMailReqWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "SendTestMailReqWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> SendTestMailReqWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "SendTestMailReq" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SendTestMailReq_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onUnauthorized, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onUnauthorized(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="SendTestMailReq" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SendTestMailReq_Validate(Commvault.Powershell.Models.ISendTestMailReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Get a preview of servers affected with create server group operation</summary> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ServerGroupsCreationPreview(Commvault.Powershell.Models.IAutomaticServerGroupAssociationDetails body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerGroupPreviewResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/Preview" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ServerGroupsCreationPreview_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ServerGroupsCreationPreview" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ServerGroupsCreationPreview_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateServerGroupPreviewResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateServerGroupPreviewResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ServerGroupsCreationPreview" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ServerGroupsCreationPreview_Validate(Commvault.Powershell.Models.IAutomaticServerGroupAssociationDetails body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to update synthetic full schedule on plan based on retention settings</summary> /// <param name="planId">Id of the Plan to update</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ServerPlan(long planId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/Retention/Synthfull" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ServerPlan_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to update synthetic full schedule on plan based on retention settings</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task ServerPlanViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/Retention/Synthfull$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/Retention/Synthfull'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/Retention/Synthfull" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.ServerPlan_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to update synthetic full schedule on plan based on retention settings</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ServerPlanViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/Retention/Synthfull$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/Retention/Synthfull'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/Retention/Synthfull" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ServerPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Used to update synthetic full schedule on plan based on retention settings</summary> /// <param name="planId">Id of the Plan to update</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ServerPlanWithResult(long planId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/Retention/Synthfull" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.ServerPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "ServerPlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> ServerPlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "ServerPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ServerPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="ServerPlan" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="planId">Id of the Plan to update</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task ServerPlan_Validate(long planId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Endpoint to Change the Access Node</summary> /// <param name="hypervisorId">Hypervisor ID to update the Access Node</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SetHypervisorAccessNode(long hypervisorId, Commvault.Powershell.Models.IPathsPghlw2V4HypervisorHypervisoridAccessnodePutRequestbodyContentApplicationJsonSchema body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + (hypervisorId.ToString()) + "/AccessNode" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SetHypervisorAccessNode_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Endpoint to Change the Access Node</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SetHypervisorAccessNodeViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IPathsPghlw2V4HypervisorHypervisoridAccessnodePutRequestbodyContentApplicationJsonSchema body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Hypervisor/(?<hypervisorId>[^/]+)/AccessNode$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Hypervisor/{hypervisorId}/AccessNode'"); } // replace URI parameters with values from identity var hypervisorId = _match.Groups["hypervisorId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + hypervisorId + "/AccessNode" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SetHypervisorAccessNode_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Endpoint to Change the Access Node</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> SetHypervisorAccessNodeViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IPathsPghlw2V4HypervisorHypervisoridAccessnodePutRequestbodyContentApplicationJsonSchema body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Hypervisor/(?<hypervisorId>[^/]+)/AccessNode$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Hypervisor/{hypervisorId}/AccessNode'"); } // replace URI parameters with values from identity var hypervisorId = _match.Groups["hypervisorId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + hypervisorId + "/AccessNode" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SetHypervisorAccessNodeWithResult_Call (request, eventListener,sender); } } /// <summary>Endpoint to Change the Access Node</summary> /// <param name="hypervisorId">Hypervisor ID to update the Access Node</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> SetHypervisorAccessNodeWithResult(long hypervisorId, Commvault.Powershell.Models.IPathsPghlw2V4HypervisorHypervisoridAccessnodePutRequestbodyContentApplicationJsonSchema body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + (hypervisorId.ToString()) + "/AccessNode" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SetHypervisorAccessNodeWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "SetHypervisorAccessNodeWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> SetHypervisorAccessNodeWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "SetHypervisorAccessNode" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SetHypervisorAccessNode_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="SetHypervisorAccessNode" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="hypervisorId">Hypervisor ID to update the Access Node</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SetHypervisorAccessNode_Validate(long hypervisorId, Commvault.Powershell.Models.IPathsPghlw2V4HypervisorHypervisoridAccessnodePutRequestbodyContentApplicationJsonSchema body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Endpoint to set FBR</summary> /// <param name="hypervisorId">Linux Media Agent to set as FBR for linux File based restores</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SetHypervisorFbr(long hypervisorId, Commvault.Powershell.Models.IPaths1OwzkoeV4HypervisorHypervisoridFbrPutRequestbodyContentApplicationJsonSchema body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateHypervisorResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + (hypervisorId.ToString()) + "/FBR" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SetHypervisorFbr_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Endpoint to set FBR</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SetHypervisorFbrViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IPaths1OwzkoeV4HypervisorHypervisoridFbrPutRequestbodyContentApplicationJsonSchema body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateHypervisorResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Hypervisor/(?<hypervisorId>[^/]+)/FBR$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Hypervisor/{hypervisorId}/FBR'"); } // replace URI parameters with values from identity var hypervisorId = _match.Groups["hypervisorId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Hypervisor/" + hypervisorId + "/FBR" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SetHypervisorFbr_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "SetHypervisorFbr" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SetHypervisorFbr_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateHypervisorResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateHypervisorResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="SetHypervisorFbr" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="hypervisorId">Linux Media Agent to set as FBR for linux File based restores</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SetHypervisorFbr_Validate(long hypervisorId, Commvault.Powershell.Models.IPaths1OwzkoeV4HypervisorHypervisoridFbrPutRequestbodyContentApplicationJsonSchema body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Api to set region for an entity.</summary> /// <param name="entityType">Type of the entity</param> /// <param name="entityId">Unique id for the entity</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SetRegionForEntity(string entityType, long entityId, Commvault.Powershell.Models.IEntityRegionInfo body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/entity/" + global::System.Uri.EscapeDataString(entityType) + "/" + (entityId.ToString()) + "/region" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SetRegionForEntity_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Api to set region for an entity.</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SetRegionForEntityViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IEntityRegionInfo body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/entity/(?<entityType>[^/]+)/(?<entityId>[^/]+)/region$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/entity/{entityType}/{entityId}/region'"); } // replace URI parameters with values from identity var entityType = _match.Groups["entityType"].Value; var entityId = _match.Groups["entityId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/entity/" + entityType + "/" + entityId + "/region" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SetRegionForEntity_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Api to set region for an entity.</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> SetRegionForEntityViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IEntityRegionInfo body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/entity/(?<entityType>[^/]+)/(?<entityId>[^/]+)/region$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/entity/{entityType}/{entityId}/region'"); } // replace URI parameters with values from identity var entityType = _match.Groups["entityType"].Value; var entityId = _match.Groups["entityId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/entity/" + entityType + "/" + entityId + "/region" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SetRegionForEntityWithResult_Call (request, eventListener,sender); } } /// <summary>Api to set region for an entity.</summary> /// <param name="entityType">Type of the entity</param> /// <param name="entityId">Unique id for the entity</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> SetRegionForEntityWithResult(string entityType, long entityId, Commvault.Powershell.Models.IEntityRegionInfo body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/entity/" + global::System.Uri.EscapeDataString(entityType) + "/" + (entityId.ToString()) + "/region" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SetRegionForEntityWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "SetRegionForEntityWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> SetRegionForEntityWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "SetRegionForEntity" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SetRegionForEntity_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="SetRegionForEntity" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="entityType">Type of the entity</param> /// <param name="entityId">Unique id for the entity</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SetRegionForEntity_Validate(string entityType, long entityId, Commvault.Powershell.Models.IEntityRegionInfo body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(entityType),entityType); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to list snaps for a particular Job Id</summary> /// <param name="jobId"></param> /// <param name="commcellId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapByJobs(long jobId, long? commcellId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths11T578Jv4StoragearraysJobJobidSnapsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Job/" + (jobId.ToString()) + "/Snaps" + "?" + (null == commcellId ? global::System.String.Empty : "commcellId=" + global::System.Uri.EscapeDataString(commcellId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapByJobs_Call (request, onOk,eventListener,sender); } } /// <summary>API to list snaps for a particular Job Id</summary> /// <param name="viaIdentity"></param> /// <param name="commcellId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapByJobsViaIdentity(global::System.String viaIdentity, long? commcellId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths11T578Jv4StoragearraysJobJobidSnapsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Job/(?<jobId>[^/]+)/Snaps$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Job/{jobId}/Snaps'"); } // replace URI parameters with values from identity var jobId = _match.Groups["jobId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Job/" + jobId + "/Snaps" + "?" + (null == commcellId ? global::System.String.Empty : "commcellId=" + global::System.Uri.EscapeDataString(commcellId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapByJobs_Call (request, onOk,eventListener,sender); } } /// <summary>API to list snaps for a particular Job Id</summary> /// <param name="viaIdentity"></param> /// <param name="commcellId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths11T578Jv4StoragearraysJobJobidSnapsGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths11T578Jv4StoragearraysJobJobidSnapsGetResponses200ContentApplicationJsonSchema> SnapByJobsViaIdentityWithResult(global::System.String viaIdentity, long? commcellId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/Job/(?<jobId>[^/]+)/Snaps$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/Job/{jobId}/Snaps'"); } // replace URI parameters with values from identity var jobId = _match.Groups["jobId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Job/" + jobId + "/Snaps" + "?" + (null == commcellId ? global::System.String.Empty : "commcellId=" + global::System.Uri.EscapeDataString(commcellId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapByJobsWithResult_Call (request, eventListener,sender); } } /// <summary>API to list snaps for a particular Job Id</summary> /// <param name="jobId"></param> /// <param name="commcellId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths11T578Jv4StoragearraysJobJobidSnapsGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths11T578Jv4StoragearraysJobJobidSnapsGetResponses200ContentApplicationJsonSchema> SnapByJobsWithResult(long jobId, long? commcellId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/Job/" + (jobId.ToString()) + "/Snaps" + "?" + (null == commcellId ? global::System.String.Empty : "commcellId=" + global::System.Uri.EscapeDataString(commcellId.ToString())) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Get, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapByJobsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "SnapByJobsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths11T578Jv4StoragearraysJobJobidSnapsGetResponses200ContentApplicationJsonSchema>" /// /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths11T578Jv4StoragearraysJobJobidSnapsGetResponses200ContentApplicationJsonSchema> SnapByJobsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths11T578Jv4StoragearraysJobJobidSnapsGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "SnapByJobs" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapByJobs_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPaths11T578Jv4StoragearraysJobJobidSnapsGetResponses200ContentApplicationJsonSchema>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.Paths11T578Jv4StoragearraysJobJobidSnapsGetResponses200ContentApplicationJsonSchema.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="SnapByJobs" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="jobId"></param> /// <param name="commcellId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapByJobs_Validate(long jobId, long? commcellId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Deleting an unmounted or created snapshot from Storage Arrays</summary> /// <param name="arrayId"></param> /// <param name="body">Request template of delete snapshots</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapDelete(long arrayId, Commvault.Powershell.Models.IDeleteSnapReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapDelete_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Deleting an unmounted or created snapshot from Storage Arrays</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template of delete snapshots</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapDeleteViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IDeleteSnapReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/Delete$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/Delete'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapDelete_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Deleting an unmounted or created snapshot from Storage Arrays</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template of delete snapshots</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapDeleteViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IDeleteSnapReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/Delete$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/Delete'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapDeleteWithResult_Call (request, eventListener,sender); } } /// <summary>Deleting an unmounted or created snapshot from Storage Arrays</summary> /// <param name="arrayId"></param> /// <param name="body">Request template of delete snapshots</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapDeleteWithResult(long arrayId, Commvault.Powershell.Models.IDeleteSnapReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/Delete" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapDeleteWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "SnapDeleteWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapDeleteWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "SnapDelete" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="SnapDelete" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="arrayId"></param> /// <param name="body">Request template of delete snapshots</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapDelete_Validate(long arrayId, Commvault.Powershell.Models.IDeleteSnapReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary> /// Force deleting an unmounted or created snapshot from Storage Arrays. Please be aware, triggering this API will not delete /// the snapshots from the storage array, so ensure that you delete snapshots on the array before using this operation. /// </summary> /// <param name="arrayId"></param> /// <param name="body">snapForceReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapForceDelete(long arrayId, Commvault.Powershell.Models.ISnapForceReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/Delete/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapForceDelete_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary> /// Force deleting an unmounted or created snapshot from Storage Arrays. Please be aware, triggering this API will not delete /// the snapshots from the storage array, so ensure that you delete snapshots on the array before using this operation. /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">snapForceReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapForceDeleteViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapForceReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/Delete/Force$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/Delete/Force'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/Delete/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapForceDelete_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary> /// Force deleting an unmounted or created snapshot from Storage Arrays. Please be aware, triggering this API will not delete /// the snapshots from the storage array, so ensure that you delete snapshots on the array before using this operation. /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">snapForceReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapForceDeleteViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapForceReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/Delete/Force$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/Delete/Force'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/Delete/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapForceDeleteWithResult_Call (request, eventListener,sender); } } /// <summary> /// Force deleting an unmounted or created snapshot from Storage Arrays. Please be aware, triggering this API will not delete /// the snapshots from the storage array, so ensure that you delete snapshots on the array before using this operation. /// </summary> /// <param name="arrayId"></param> /// <param name="body">snapForceReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapForceDeleteWithResult(long arrayId, Commvault.Powershell.Models.ISnapForceReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/Delete/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapForceDeleteWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "SnapForceDeleteWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapForceDeleteWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "SnapForceDelete" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapForceDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="SnapForceDelete" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="arrayId"></param> /// <param name="body">snapForceReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapForceDelete_Validate(long arrayId, Commvault.Powershell.Models.ISnapForceReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary> /// Force unmounting a mounted Snapshot from Storage Array. Please be aware, triggering this API will not physically unmount /// the snapshots from the storage array or MA, so ensure that you unmapped the snapshots on the array and cleanup the mount /// host and LVM before using this operation. /// </summary> /// <param name="arrayId"></param> /// <param name="body">snapForceReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapForceUnmount(long arrayId, Commvault.Powershell.Models.ISnapForceReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/Unmount/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapForceUnmount_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary> /// Force unmounting a mounted Snapshot from Storage Array. Please be aware, triggering this API will not physically unmount /// the snapshots from the storage array or MA, so ensure that you unmapped the snapshots on the array and cleanup the mount /// host and LVM before using this operation. /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">snapForceReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapForceUnmountViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapForceReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/Unmount/Force$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/Unmount/Force'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/Unmount/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapForceUnmount_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary> /// Force unmounting a mounted Snapshot from Storage Array. Please be aware, triggering this API will not physically unmount /// the snapshots from the storage array or MA, so ensure that you unmapped the snapshots on the array and cleanup the mount /// host and LVM before using this operation. /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">snapForceReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapForceUnmountViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapForceReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/Unmount/Force$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/Unmount/Force'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/Unmount/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapForceUnmountWithResult_Call (request, eventListener,sender); } } /// <summary> /// Force unmounting a mounted Snapshot from Storage Array. Please be aware, triggering this API will not physically unmount /// the snapshots from the storage array or MA, so ensure that you unmapped the snapshots on the array and cleanup the mount /// host and LVM before using this operation. /// </summary> /// <param name="arrayId"></param> /// <param name="body">snapForceReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapForceUnmountWithResult(long arrayId, Commvault.Powershell.Models.ISnapForceReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/Unmount/Force" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapForceUnmountWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "SnapForceUnmountWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapForceUnmountWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "SnapForceUnmount" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapForceUnmount_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="SnapForceUnmount" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="arrayId"></param> /// <param name="body">snapForceReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapForceUnmount_Validate(long arrayId, Commvault.Powershell.Models.ISnapForceReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Mounting a snapshot from the Storage Array</summary> /// <param name="arrayId"></param> /// <param name="body">Request template for Mounting Snapshots. scsiServer refers to the iSCSI server which the user can choose /// while mounting.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapMount(long arrayId, Commvault.Powershell.Models.IMountReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/Mount" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapMount_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Mounting a snapshot from the Storage Array</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template for Mounting Snapshots. scsiServer refers to the iSCSI server which the user can choose /// while mounting.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapMountViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IMountReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/Mount$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/Mount'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/Mount" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapMount_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Mounting a snapshot from the Storage Array</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template for Mounting Snapshots. scsiServer refers to the iSCSI server which the user can choose /// while mounting.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapMountViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IMountReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/Mount$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/Mount'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/Mount" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapMountWithResult_Call (request, eventListener,sender); } } /// <summary>Mounting a snapshot from the Storage Array</summary> /// <param name="arrayId"></param> /// <param name="body">Request template for Mounting Snapshots. scsiServer refers to the iSCSI server which the user can choose /// while mounting.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapMountWithResult(long arrayId, Commvault.Powershell.Models.IMountReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/Mount" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapMountWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "SnapMountWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapMountWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "SnapMount" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapMount_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="SnapMount" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="arrayId"></param> /// <param name="body">Request template for Mounting Snapshots. scsiServer refers to the iSCSI server which the user can choose /// while mounting.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapMount_Validate(long arrayId, Commvault.Powershell.Models.IMountReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Starts a workflow snap reconcile for array</summary> /// <param name="arrayId"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapReconWorkflow(long arrayId, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/Recon" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapReconWorkflow_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Starts a workflow snap reconcile for array</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapReconWorkflowViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/Recon$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/Recon'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/Recon" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapReconWorkflow_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Starts a workflow snap reconcile for array</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapReconWorkflowViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/Recon$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/Recon'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/Recon" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapReconWorkflowWithResult_Call (request, eventListener,sender); } } /// <summary>Starts a workflow snap reconcile for array</summary> /// <param name="arrayId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapReconWorkflowWithResult(long arrayId, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/Recon" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapReconWorkflowWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "SnapReconWorkflowWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapReconWorkflowWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "SnapReconWorkflow" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapReconWorkflow_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="SnapReconWorkflow" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="arrayId"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapReconWorkflow_Validate(long arrayId, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Reverting a created or unmounted snapshot from the storage array</summary> /// <param name="arrayId"></param> /// <param name="body">Request template for revert snapshots</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapRevert(long arrayId, Commvault.Powershell.Models.ISnapRevertReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/Revert" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapRevert_Call (request, onOk,eventListener,sender); } } /// <summary>Reverting a created or unmounted snapshot from the storage array</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template for revert snapshots</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapRevertViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapRevertReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/Revert$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/Revert'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/Revert" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapRevert_Call (request, onOk,eventListener,sender); } } /// <summary>Reverting a created or unmounted snapshot from the storage array</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template for revert snapshots</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapRevertViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ISnapRevertReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/Revert$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/Revert'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/Revert" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapRevertWithResult_Call (request, eventListener,sender); } } /// <summary>Reverting a created or unmounted snapshot from the storage array</summary> /// <param name="arrayId"></param> /// <param name="body">Request template for revert snapshots</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapRevertWithResult(long arrayId, Commvault.Powershell.Models.ISnapRevertReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/Revert" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapRevertWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "SnapRevertWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapRevertWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "SnapRevert" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapRevert_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="SnapRevert" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="arrayId"></param> /// <param name="body">Request template for revert snapshots</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapRevert_Validate(long arrayId, Commvault.Powershell.Models.ISnapRevertReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Unmounting a mounted Snapshot from Storage Array</summary> /// <param name="arrayId"></param> /// <param name="body">Request template for unmount request of snapshots</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapUnmount(long arrayId, Commvault.Powershell.Models.IUnmountSnapReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/Unmount" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapUnmount_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Unmounting a mounted Snapshot from Storage Array</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template for unmount request of snapshots</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SnapUnmountViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUnmountSnapReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/Unmount$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/Unmount'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/Unmount" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SnapUnmount_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Unmounting a mounted Snapshot from Storage Array</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request template for unmount request of snapshots</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapUnmountViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUnmountSnapReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/StorageArrays/(?<arrayId>[^/]+)/Snaps/Unmount$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/StorageArrays/{arrayId}/Snaps/Unmount'"); } // replace URI parameters with values from identity var arrayId = _match.Groups["arrayId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + arrayId + "/Snaps/Unmount" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapUnmountWithResult_Call (request, eventListener,sender); } } /// <summary>Unmounting a mounted Snapshot from Storage Array</summary> /// <param name="arrayId"></param> /// <param name="body">Request template for unmount request of snapshots</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapUnmountWithResult(long arrayId, Commvault.Powershell.Models.IUnmountSnapReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/StorageArrays/" + (arrayId.ToString()) + "/Snaps/Unmount" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SnapUnmountWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "SnapUnmountWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp> SnapUnmountWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "SnapUnmount" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapUnmount_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ISnapReconResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.SnapReconResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="SnapUnmount" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="arrayId"></param> /// <param name="body">Request template for unmount request of snapshots</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SnapUnmount_Validate(long arrayId, Commvault.Powershell.Models.IUnmountSnapReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Sync the Credentials configured for Cyber Resilience with latest information</summary> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task SyncCyberResilienceCredentials(global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CyberResilience/Credentials/Sync" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.SyncCyberResilienceCredentials_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Sync the Credentials configured for Cyber Resilience with latest information</summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>" /> that /// will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse> SyncCyberResilienceCredentialsWithResult(Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CyberResilience/Credentials/Sync" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.SyncCyberResilienceCredentialsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "SyncCyberResilienceCredentialsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>" /> that /// will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse> SyncCyberResilienceCredentialsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "SyncCyberResilienceCredentials" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SyncCyberResilienceCredentials_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICyberResilienceGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CyberResilienceGenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="SyncCyberResilienceCredentials" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task SyncCyberResilienceCredentials_Validate(Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary> /// Verifies cloud resource connectivity from a list of backup gateways to given hostname and port /// </summary> /// <param name="body">Request body for checking cloud resource connectivity</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task TestCloudConnection(Commvault.Powershell.Models.ITestCloudConnectionReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<string>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onUnauthorized, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/CloudApps/TestCloudConnection" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.TestCloudConnection_Call (request, onOk,onBadRequest,onUnauthorized,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "TestCloudConnection" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task TestCloudConnection_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<string>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onUnauthorized, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,null /* deserializeFromResponse doesn't support '-none-' C:\Users\Administrator\.autorest\@autorest_powershell@4.0.708\node_modules\@autorest\powershell\dist\llcsharp\schema\string.js*/); break; } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onUnauthorized(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="TestCloudConnection" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Request body for checking cloud resource connectivity</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task TestCloudConnection_Validate(Commvault.Powershell.Models.ITestCloudConnectionReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Test a Yaml paylod against a restore modfier</summary> /// <param name="clusterId">Id of the cluster whose modifier needs to be tested</param> /// <param name="body">Request body for K8s Modifier Test Operation</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task TestK8SYamlForRestore(long clusterId, Commvault.Powershell.Models.ITestK8SModifierReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + (clusterId.ToString()) + "/Modifier/Test" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.TestK8SYamlForRestore_Call (request, onOk,eventListener,sender); } } /// <summary>Test a Yaml paylod against a restore modfier</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request body for K8s Modifier Test Operation</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task TestK8SYamlForRestoreViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ITestK8SModifierReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Kubernetes/(?<clusterId>[^/]+)/Modifier/Test$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Kubernetes/{clusterId}/Modifier/Test'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + clusterId + "/Modifier/Test" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.TestK8SYamlForRestore_Call (request, onOk,eventListener,sender); } } /// <summary>Test a Yaml paylod against a restore modfier</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request body for K8s Modifier Test Operation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp> TestK8SYamlForRestoreViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ITestK8SModifierReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Kubernetes/(?<clusterId>[^/]+)/Modifier/Test$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Kubernetes/{clusterId}/Modifier/Test'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + clusterId + "/Modifier/Test" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.TestK8SYamlForRestoreWithResult_Call (request, eventListener,sender); } } /// <summary>Test a Yaml paylod against a restore modfier</summary> /// <param name="clusterId">Id of the cluster whose modifier needs to be tested</param> /// <param name="body">Request body for K8s Modifier Test Operation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp> TestK8SYamlForRestoreWithResult(long clusterId, Commvault.Powershell.Models.ITestK8SModifierReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Kubernetes/" + (clusterId.ToString()) + "/Modifier/Test" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.TestK8SYamlForRestoreWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "TestK8SYamlForRestoreWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp> TestK8SYamlForRestoreWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.K8SRestoreModifierApiresp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "TestK8SYamlForRestore" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task TestK8SYamlForRestore_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IK8SRestoreModifierApiresp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.K8SRestoreModifierApiresp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="TestK8SYamlForRestore" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="clusterId">Id of the cluster whose modifier needs to be tested</param> /// <param name="body">Request body for K8s Modifier Test Operation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task TestK8SYamlForRestore_Validate(long clusterId, Commvault.Powershell.Models.ITestK8SModifierReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Unpin triggered alerts</summary> /// <param name="id"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UnpinTriggeredAlerts(long id, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + (id.ToString()) + "/Unpin" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UnpinTriggeredAlerts_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Unpin triggered alerts</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UnpinTriggeredAlertsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/TriggeredAlerts/(?<id>[^/]+)/Unpin$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/TriggeredAlerts/{id}/Unpin'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + id + "/Unpin" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UnpinTriggeredAlerts_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Unpin triggered alerts</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UnpinTriggeredAlertsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/TriggeredAlerts/(?<id>[^/]+)/Unpin$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/TriggeredAlerts/{id}/Unpin'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + id + "/Unpin" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UnpinTriggeredAlertsWithResult_Call (request, eventListener,sender); } } /// <summary>Unpin triggered alerts</summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UnpinTriggeredAlertsWithResult(long id, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + (id.ToString()) + "/Unpin" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UnpinTriggeredAlertsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UnpinTriggeredAlertsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UnpinTriggeredAlertsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UnpinTriggeredAlerts" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UnpinTriggeredAlerts_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UnpinTriggeredAlerts" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UnpinTriggeredAlerts_Validate(long id, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Mark a triggered alert as unread</summary> /// <param name="id"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UnreadTriggeredAlerts(long id, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + (id.ToString()) + "/Unread" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UnreadTriggeredAlerts_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Mark a triggered alert as unread</summary> /// <param name="viaIdentity"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UnreadTriggeredAlertsViaIdentity(global::System.String viaIdentity, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/TriggeredAlerts/(?<id>[^/]+)/Unread$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/TriggeredAlerts/{id}/Unread'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + id + "/Unread" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UnreadTriggeredAlerts_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Mark a triggered alert as unread</summary> /// <param name="viaIdentity"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UnreadTriggeredAlertsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/TriggeredAlerts/(?<id>[^/]+)/Unread$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/TriggeredAlerts/{id}/Unread'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + id + "/Unread" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UnreadTriggeredAlertsWithResult_Call (request, eventListener,sender); } } /// <summary>Mark a triggered alert as unread</summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UnreadTriggeredAlertsWithResult(long id, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + (id.ToString()) + "/Unread" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UnreadTriggeredAlertsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UnreadTriggeredAlertsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UnreadTriggeredAlertsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UnreadTriggeredAlerts" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UnreadTriggeredAlerts_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UnreadTriggeredAlerts" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UnreadTriggeredAlerts_Validate(long id, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { } } /// <summary>Modify access path details of specific bucket of a specific cloud storage</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="bucketId">Id of Bucket</param> /// <param name="accessPathId">Id of access path (can be fetched from GET Bucket Details API)</param> /// <param name="body">CloudStorageAdvanced</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateAccessPathOfBucketOfCloudStorage(long cloudStorageId, long bucketId, long accessPathId, Commvault.Powershell.Models.ICloudStorageAdvanced body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/Bucket/" + (bucketId.ToString()) + "/AccessPath/" + (accessPathId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateAccessPathOfBucketOfCloudStorage_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Modify access path details of specific bucket of a specific cloud storage</summary> /// <param name="viaIdentity"></param> /// <param name="body">CloudStorageAdvanced</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateAccessPathOfBucketOfCloudStorageViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ICloudStorageAdvanced body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/Bucket/(?<bucketId>[^/]+)/AccessPath/(?<accessPathId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/Bucket/{bucketId}/AccessPath/{accessPathId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var bucketId = _match.Groups["bucketId"].Value; var accessPathId = _match.Groups["accessPathId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/Bucket/" + bucketId + "/AccessPath/" + accessPathId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateAccessPathOfBucketOfCloudStorage_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Modify access path details of specific bucket of a specific cloud storage</summary> /// <param name="viaIdentity"></param> /// <param name="body">CloudStorageAdvanced</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateAccessPathOfBucketOfCloudStorageViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ICloudStorageAdvanced body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/Bucket/(?<bucketId>[^/]+)/AccessPath/(?<accessPathId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/Bucket/{bucketId}/AccessPath/{accessPathId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var bucketId = _match.Groups["bucketId"].Value; var accessPathId = _match.Groups["accessPathId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/Bucket/" + bucketId + "/AccessPath/" + accessPathId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateAccessPathOfBucketOfCloudStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Modify access path details of specific bucket of a specific cloud storage</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="bucketId">Id of Bucket</param> /// <param name="accessPathId">Id of access path (can be fetched from GET Bucket Details API)</param> /// <param name="body">CloudStorageAdvanced</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateAccessPathOfBucketOfCloudStorageWithResult(long cloudStorageId, long bucketId, long accessPathId, Commvault.Powershell.Models.ICloudStorageAdvanced body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/Bucket/" + (bucketId.ToString()) + "/AccessPath/" + (accessPathId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateAccessPathOfBucketOfCloudStorageWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateAccessPathOfBucketOfCloudStorageWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateAccessPathOfBucketOfCloudStorageWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "UpdateAccessPathOfBucketOfCloudStorage" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateAccessPathOfBucketOfCloudStorage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateAccessPathOfBucketOfCloudStorage" /> method. Call this like the actual call, but /// you will get validation events back. /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="bucketId">Id of Bucket</param> /// <param name="accessPathId">Id of access path (can be fetched from GET Bucket Details API)</param> /// <param name="body">CloudStorageAdvanced</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateAccessPathOfBucketOfCloudStorage_Validate(long cloudStorageId, long bucketId, long accessPathId, Commvault.Powershell.Models.ICloudStorageAdvanced body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Update an AD/LDAP domain</summary> /// <param name="domainId">ID of the AD/LDAP domain</param> /// <param name="body">Properties of the domain to be updated</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateAdldap(long domainId, Commvault.Powershell.Models.IUpdateAdldap body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LDAP/" + (domainId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateAdldap_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Update an AD/LDAP domain</summary> /// <param name="viaIdentity"></param> /// <param name="body">Properties of the domain to be updated</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateAdldapViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateAdldap body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LDAP/(?<domainId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LDAP/{domainId}'"); } // replace URI parameters with values from identity var domainId = _match.Groups["domainId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LDAP/" + domainId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateAdldap_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Update an AD/LDAP domain</summary> /// <param name="viaIdentity"></param> /// <param name="body">Properties of the domain to be updated</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateAdldapViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateAdldap body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LDAP/(?<domainId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LDAP/{domainId}'"); } // replace URI parameters with values from identity var domainId = _match.Groups["domainId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LDAP/" + domainId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateAdldapWithResult_Call (request, eventListener,sender); } } /// <summary>Update an AD/LDAP domain</summary> /// <param name="domainId">ID of the AD/LDAP domain</param> /// <param name="body">Properties of the domain to be updated</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateAdldapWithResult(long domainId, Commvault.Powershell.Models.IUpdateAdldap body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LDAP/" + (domainId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateAdldapWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateAdldapWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateAdldapWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateAdldap" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateAdldap_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateAdldap" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="domainId">ID of the AD/LDAP domain</param> /// <param name="body">Properties of the domain to be updated</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateAdldap_Validate(long domainId, Commvault.Powershell.Models.IUpdateAdldap body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateArchiveBackupDestination(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdateArchivePlanBackupDestination body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateArchiveBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Modify Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateArchiveBackupDestinationViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateArchivePlanBackupDestination body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateArchiveBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Modify Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateArchiveBackupDestinationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateArchivePlanBackupDestination body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateArchiveBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary>Modify Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateArchiveBackupDestinationWithResult(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdateArchivePlanBackupDestination body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateArchiveBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateArchiveBackupDestinationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateArchiveBackupDestinationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateArchiveBackupDestination" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateArchiveBackupDestination_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateArchiveBackupDestination" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateArchiveBackupDestination_Validate(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdateArchivePlanBackupDestination body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify existing archive plan details</summary> /// <param name="planId">Id of the plan</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateArchivePlanById(long planId, Commvault.Powershell.Models.IUpdateArchivePlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateArchivePlanById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Modify existing archive plan details</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateArchivePlanByIdViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateArchivePlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateArchivePlanById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Modify existing archive plan details</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateArchivePlanByIdViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateArchivePlan body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ArchivePlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ArchivePlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateArchivePlanByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Modify existing archive plan details</summary> /// <param name="planId">Id of the plan</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateArchivePlanByIdWithResult(long planId, Commvault.Powershell.Models.IUpdateArchivePlan body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ArchivePlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateArchivePlanByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateArchivePlanByIdWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateArchivePlanByIdWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateArchivePlanById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateArchivePlanById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateArchivePlanById" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the plan</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateArchivePlanById_Validate(long planId, Commvault.Powershell.Models.IUpdateArchivePlan body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateBackupDestination(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdatePlanBackupDestination body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Update all the included/excluded entities of backupdestination.</summary> /// <param name="planId"></param> /// <param name="backupDestinationId"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateBackupDestinationAssociations(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdateBackupDestinationAssociationsReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) + "/Associations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateBackupDestinationAssociations_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Update all the included/excluded entities of backupdestination.</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateBackupDestinationAssociationsViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateBackupDestinationAssociationsReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/(?<planId>[^/]+)/BackupDestination/(?<backupDestinationId>[^/]+)/Associations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/{planId}/BackupDestination/{backupDestinationId}/Associations'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["backupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + planId + "/BackupDestination/" + backupDestinationId + "/Associations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateBackupDestinationAssociations_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Update all the included/excluded entities of backupdestination.</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateBackupDestinationAssociationsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateBackupDestinationAssociationsReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/(?<planId>[^/]+)/BackupDestination/(?<backupDestinationId>[^/]+)/Associations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/{planId}/BackupDestination/{backupDestinationId}/Associations'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["backupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + planId + "/BackupDestination/" + backupDestinationId + "/Associations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateBackupDestinationAssociationsWithResult_Call (request, eventListener,sender); } } /// <summary>Update all the included/excluded entities of backupdestination.</summary> /// <param name="planId"></param> /// <param name="backupDestinationId"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateBackupDestinationAssociationsWithResult(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdateBackupDestinationAssociationsReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) + "/Associations" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateBackupDestinationAssociationsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateBackupDestinationAssociationsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateBackupDestinationAssociationsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "UpdateBackupDestinationAssociations" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateBackupDestinationAssociations_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateBackupDestinationAssociations" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="planId"></param> /// <param name="backupDestinationId"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateBackupDestinationAssociations_Validate(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdateBackupDestinationAssociationsReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify Backup Destination details for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateBackupDestinationDetails(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdatePlanBackupDestinationDetails body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/ServerPlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateBackupDestinationDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Modify Backup Destination details for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateBackupDestinationDetailsViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdatePlanBackupDestinationDetails body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/ServerPlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/ServerPlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/ServerPlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateBackupDestinationDetails_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Modify Backup Destination details for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateBackupDestinationDetailsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdatePlanBackupDestinationDetails body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/ServerPlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/ServerPlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/ServerPlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateBackupDestinationDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Modify Backup Destination details for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateBackupDestinationDetailsWithResult(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdatePlanBackupDestinationDetails body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/ServerPlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateBackupDestinationDetailsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateBackupDestinationDetailsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateBackupDestinationDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateBackupDestinationDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateBackupDestinationDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateBackupDestinationDetails" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateBackupDestinationDetails_Validate(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdatePlanBackupDestinationDetails body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateBackupDestinationViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdatePlanBackupDestination body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Modify Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateBackupDestinationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdatePlanBackupDestination body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary>Modify Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateBackupDestinationWithResult(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdatePlanBackupDestination body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateBackupDestinationWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateBackupDestinationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Modify Backup Destination. Only primary backup destination will be considered for region updation. /// If the primary backup destination is not associated with a plan, only then the region associaion can be modified. /// </summary> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body">Region can be modified only when the backup destination does not belong to a region already</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateBackupDestinationWithoutPlanInfo(long backupDestinationId, Commvault.Powershell.Models.IUpdateBackupDestination body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateBackupDestinationWithoutPlanInfo_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary> /// Modify Backup Destination. Only primary backup destination will be considered for region updation. /// If the primary backup destination is not associated with a plan, only then the region associaion can be modified. /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">Region can be modified only when the backup destination does not belong to a region already</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateBackupDestinationWithoutPlanInfoViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateBackupDestination body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateBackupDestinationWithoutPlanInfo_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary> /// Modify Backup Destination. Only primary backup destination will be considered for region updation. /// If the primary backup destination is not associated with a plan, only then the region associaion can be modified. /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">Region can be modified only when the backup destination does not belong to a region already</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateBackupDestinationWithoutPlanInfoViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateBackupDestination body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Plan/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Plan/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateBackupDestinationWithoutPlanInfoWithResult_Call (request, eventListener,sender); } } /// <summary> /// Modify Backup Destination. Only primary backup destination will be considered for region updation. /// If the primary backup destination is not associated with a plan, only then the region associaion can be modified. /// </summary> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body">Region can be modified only when the backup destination does not belong to a region already</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateBackupDestinationWithoutPlanInfoWithResult(long backupDestinationId, Commvault.Powershell.Models.IUpdateBackupDestination body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateBackupDestinationWithoutPlanInfoWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateBackupDestinationWithoutPlanInfoWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateBackupDestinationWithoutPlanInfoWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "UpdateBackupDestinationWithoutPlanInfo" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateBackupDestinationWithoutPlanInfo_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateBackupDestinationWithoutPlanInfo" /> method. Call this like the actual call, but /// you will get validation events back. /// </summary> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body">Region can be modified only when the backup destination does not belong to a region already</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateBackupDestinationWithoutPlanInfo_Validate(long backupDestinationId, Commvault.Powershell.Models.IUpdateBackupDestination body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Actual wire call for <see cref= "UpdateBackupDestination" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateBackupDestination_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateBackupDestination" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateBackupDestination_Validate(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdatePlanBackupDestination body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify the properties of an existing mount path</summary> /// <param name="storagePoolId">Id of the disk storage to update</param> /// <param name="backupLocationId">Id of the backup location to update</param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateBackupLocation(long storagePoolId, long backupLocationId, Commvault.Powershell.Models.IUpdateBackupLocation body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateBackupLocation_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing mount path</summary> /// <param name="viaIdentity"></param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateBackupLocationViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateBackupLocation body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation/{backupLocationId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation/" + backupLocationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateBackupLocation_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing mount path</summary> /// <param name="viaIdentity"></param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateBackupLocationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateBackupLocation body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation/{backupLocationId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation/" + backupLocationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateBackupLocationWithResult_Call (request, eventListener,sender); } } /// <summary>Modify the properties of an existing mount path</summary> /// <param name="storagePoolId">Id of the disk storage to update</param> /// <param name="backupLocationId">Id of the backup location to update</param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateBackupLocationWithResult(long storagePoolId, long backupLocationId, Commvault.Powershell.Models.IUpdateBackupLocation body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateBackupLocationWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateBackupLocationWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateBackupLocationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateBackupLocation" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateBackupLocation_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateBackupLocation" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the disk storage to update</param> /// <param name="backupLocationId">Id of the backup location to update</param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateBackupLocation_Validate(long storagePoolId, long backupLocationId, Commvault.Powershell.Models.IUpdateBackupLocation body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify the properties of an existing Blackout Window</summary> /// <param name="blackoutWindowId">Id of the Blackout Window to update</param> /// <param name="body">company-refers to company to which the blackout window is associated.Dates have to be provided in unix /// time format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateBlackoutWindow(long blackoutWindowId, Commvault.Powershell.Models.IUpdateBlackoutWindow body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/BlackoutWindow/" + (blackoutWindowId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateBlackoutWindow_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing Blackout Window</summary> /// <param name="viaIdentity"></param> /// <param name="body">company-refers to company to which the blackout window is associated.Dates have to be provided in unix /// time format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateBlackoutWindowViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateBlackoutWindow body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/BlackoutWindow/(?<blackoutWindowId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/BlackoutWindow/{blackoutWindowId}'"); } // replace URI parameters with values from identity var blackoutWindowId = _match.Groups["blackoutWindowId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/BlackoutWindow/" + blackoutWindowId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateBlackoutWindow_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing Blackout Window</summary> /// <param name="viaIdentity"></param> /// <param name="body">company-refers to company to which the blackout window is associated.Dates have to be provided in unix /// time format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateBlackoutWindowViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateBlackoutWindow body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/BlackoutWindow/(?<blackoutWindowId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/BlackoutWindow/{blackoutWindowId}'"); } // replace URI parameters with values from identity var blackoutWindowId = _match.Groups["blackoutWindowId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/BlackoutWindow/" + blackoutWindowId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateBlackoutWindowWithResult_Call (request, eventListener,sender); } } /// <summary>Modify the properties of an existing Blackout Window</summary> /// <param name="blackoutWindowId">Id of the Blackout Window to update</param> /// <param name="body">company-refers to company to which the blackout window is associated.Dates have to be provided in unix /// time format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateBlackoutWindowWithResult(long blackoutWindowId, Commvault.Powershell.Models.IUpdateBlackoutWindow body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/BlackoutWindow/" + (blackoutWindowId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateBlackoutWindowWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateBlackoutWindowWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateBlackoutWindowWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateBlackoutWindow" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateBlackoutWindow_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateBlackoutWindow" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="blackoutWindowId">Id of the Blackout Window to update</param> /// <param name="body">company-refers to company to which the blackout window is associated.Dates have to be provided in unix /// time format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateBlackoutWindow_Validate(long blackoutWindowId, Commvault.Powershell.Models.IUpdateBlackoutWindow body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify details like name, encryption, security of a specific cloud storage</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateCloudStorageById(long cloudStorageId, Commvault.Powershell.Models.IUpdateCloudStorage body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateCloudStorageById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Modify details like name, encryption, security of a specific cloud storage</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateCloudStorageByIdViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateCloudStorage body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateCloudStorageById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Modify details like name, encryption, security of a specific cloud storage</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateCloudStorageByIdViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateCloudStorage body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateCloudStorageByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Modify details like name, encryption, security of a specific cloud storage</summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateCloudStorageByIdWithResult(long cloudStorageId, Commvault.Powershell.Models.IUpdateCloudStorage body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateCloudStorageByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateCloudStorageByIdWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateCloudStorageByIdWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateCloudStorageById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateCloudStorageById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateCloudStorageById" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateCloudStorageById_Validate(long cloudStorageId, Commvault.Powershell.Models.IUpdateCloudStorage body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary> /// Modify details like credentials and path for metadata Cache of a cloud storage based on Id /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="metadataCacheId">Id of metadata cache</param> /// <param name="body">If updating to a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateCloudStorageMetaDataCacheById(long cloudStorageId, long metadataCacheId, Commvault.Powershell.Models.IUpdateMetadataCacheConfiguration body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/MetadataCache/" + (metadataCacheId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateCloudStorageMetaDataCacheById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary> /// Modify details like credentials and path for metadata Cache of a cloud storage based on Id /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">If updating to a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateCloudStorageMetaDataCacheByIdViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateMetadataCacheConfiguration body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/MetadataCache/(?<metadataCacheId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/MetadataCache/{metadataCacheId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var metadataCacheId = _match.Groups["metadataCacheId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/MetadataCache/" + metadataCacheId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateCloudStorageMetaDataCacheById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary> /// Modify details like credentials and path for metadata Cache of a cloud storage based on Id /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">If updating to a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateCloudStorageMetaDataCacheByIdViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateMetadataCacheConfiguration body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Cloud/(?<cloudStorageId>[^/]+)/MetadataCache/(?<metadataCacheId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Cloud/{cloudStorageId}/MetadataCache/{metadataCacheId}'"); } // replace URI parameters with values from identity var cloudStorageId = _match.Groups["cloudStorageId"].Value; var metadataCacheId = _match.Groups["metadataCacheId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + cloudStorageId + "/MetadataCache/" + metadataCacheId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateCloudStorageMetaDataCacheByIdWithResult_Call (request, eventListener,sender); } } /// <summary> /// Modify details like credentials and path for metadata Cache of a cloud storage based on Id /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="metadataCacheId">Id of metadata cache</param> /// <param name="body">If updating to a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateCloudStorageMetaDataCacheByIdWithResult(long cloudStorageId, long metadataCacheId, Commvault.Powershell.Models.IUpdateMetadataCacheConfiguration body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Cloud/" + (cloudStorageId.ToString()) + "/MetadataCache/" + (metadataCacheId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateCloudStorageMetaDataCacheByIdWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateCloudStorageMetaDataCacheByIdWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateCloudStorageMetaDataCacheByIdWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Actual wire call for <see cref= "UpdateCloudStorageMetaDataCacheById" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateCloudStorageMetaDataCacheById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateCloudStorageMetaDataCacheById" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="cloudStorageId">Id of cloud Storage</param> /// <param name="metadataCacheId">Id of metadata cache</param> /// <param name="body">If updating to a network access path, Please add credentials or saved credentials. If both are provided, /// credentials will be taken into consideration.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateCloudStorageMetaDataCacheById_Validate(long cloudStorageId, long metadataCacheId, Commvault.Powershell.Models.IUpdateMetadataCacheConfiguration body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify the properties of an existing company</summary> /// <param name="companyId">Id of the company to update</param> /// <param name="body">Used to update the properties of an existing company</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateCompany(long companyId, Commvault.Powershell.Models.IUpdateCompany body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company/" + (companyId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateCompany_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Update a company's laptop admins.</summary> /// <param name="companyId"></param> /// <param name="body">List of users or user groups and operation type</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateCompanyLaptopAdmins(long companyId, Commvault.Powershell.Models.IUpdateLaptopAdminsReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUpdateLaptopAdminsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/LaptopAdmins" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateCompanyLaptopAdmins_Call (request, onOk,eventListener,sender); } } /// <summary>Update a company's laptop admins.</summary> /// <param name="viaIdentity"></param> /// <param name="body">List of users or user groups and operation type</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateCompanyLaptopAdminsViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateLaptopAdminsReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUpdateLaptopAdminsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/LaptopAdmins$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/LaptopAdmins'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/LaptopAdmins" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateCompanyLaptopAdmins_Call (request, onOk,eventListener,sender); } } /// <summary>Update a company's laptop admins.</summary> /// <param name="viaIdentity"></param> /// <param name="body">List of users or user groups and operation type</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUpdateLaptopAdminsResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUpdateLaptopAdminsResp> UpdateCompanyLaptopAdminsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateLaptopAdminsReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/LaptopAdmins$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/LaptopAdmins'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/LaptopAdmins" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateCompanyLaptopAdminsWithResult_Call (request, eventListener,sender); } } /// <summary>Update a company's laptop admins.</summary> /// <param name="companyId"></param> /// <param name="body">List of users or user groups and operation type</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUpdateLaptopAdminsResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUpdateLaptopAdminsResp> UpdateCompanyLaptopAdminsWithResult(long companyId, Commvault.Powershell.Models.IUpdateLaptopAdminsReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/LaptopAdmins" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateCompanyLaptopAdminsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateCompanyLaptopAdminsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUpdateLaptopAdminsResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUpdateLaptopAdminsResp> UpdateCompanyLaptopAdminsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.UpdateLaptopAdminsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateCompanyLaptopAdmins" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateCompanyLaptopAdmins_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IUpdateLaptopAdminsResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.UpdateLaptopAdminsResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateCompanyLaptopAdmins" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="companyId"></param> /// <param name="body">List of users or user groups and operation type</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateCompanyLaptopAdmins_Validate(long companyId, Commvault.Powershell.Models.IUpdateLaptopAdminsReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary> /// Assigns company's timezone as the timezone for servers with no packages installed /// </summary> /// <param name="companyId">Id of the company whose timezone is used to update timezone of servers (with no packages)</param> /// <param name="body">Request body for updating timezone for clients</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateCompanyTimezoneForServers(long companyId, Commvault.Powershell.Models.IUpdateTimezoneForClientsReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/Servers/Timezone" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateCompanyTimezoneForServers_Call (request, onOk,eventListener,sender); } } /// <summary> /// Assigns company's timezone as the timezone for servers with no packages installed /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">Request body for updating timezone for clients</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateCompanyTimezoneForServersViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateTimezoneForClientsReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/Servers/Timezone$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/Servers/Timezone'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/Servers/Timezone" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateCompanyTimezoneForServers_Call (request, onOk,eventListener,sender); } } /// <summary> /// Assigns company's timezone as the timezone for servers with no packages installed /// </summary> /// <param name="viaIdentity"></param> /// <param name="body">Request body for updating timezone for clients</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateCompanyTimezoneForServersViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateTimezoneForClientsReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Company/(?<companyId>[^/]+)/Servers/Timezone$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Company/{companyId}/Servers/Timezone'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + companyId + "/Servers/Timezone" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateCompanyTimezoneForServersWithResult_Call (request, eventListener,sender); } } /// <summary> /// Assigns company's timezone as the timezone for servers with no packages installed /// </summary> /// <param name="companyId">Id of the company whose timezone is used to update timezone of servers (with no packages)</param> /// <param name="body">Request body for updating timezone for clients</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateCompanyTimezoneForServersWithResult(long companyId, Commvault.Powershell.Models.IUpdateTimezoneForClientsReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Company/" + (companyId.ToString()) + "/Servers/Timezone" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateCompanyTimezoneForServersWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateCompanyTimezoneForServersWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateCompanyTimezoneForServersWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateCompanyTimezoneForServers" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateCompanyTimezoneForServers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateCompanyTimezoneForServers" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="companyId">Id of the company whose timezone is used to update timezone of servers (with no packages)</param> /// <param name="body">Request body for updating timezone for clients</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateCompanyTimezoneForServers_Validate(long companyId, Commvault.Powershell.Models.IUpdateTimezoneForClientsReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify the properties of an existing company</summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to update the properties of an existing company</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateCompanyViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateCompany body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/company/(?<companyId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/company/{companyId}'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company/" + companyId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateCompany_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing company</summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to update the properties of an existing company</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateCompanyViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateCompany body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/company/(?<companyId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/company/{companyId}'"); } // replace URI parameters with values from identity var companyId = _match.Groups["companyId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company/" + companyId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateCompanyWithResult_Call (request, eventListener,sender); } } /// <summary>Modify the properties of an existing company</summary> /// <param name="companyId">Id of the company to update</param> /// <param name="body">Used to update the properties of an existing company</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateCompanyWithResult(long companyId, Commvault.Powershell.Models.IUpdateCompany body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/company/" + (companyId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateCompanyWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateCompanyWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateCompanyWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateCompany" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateCompany_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateCompany" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="companyId">Id of the company to update</param> /// <param name="body">Used to update the properties of an existing company</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateCompany_Validate(long companyId, Commvault.Powershell.Models.IUpdateCompany body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to update CVFS S3 Bucket properties and User Access</summary> /// <param name="id">ID of the bucket</param> /// <param name="body">UpdateCVFSS3Bucket</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateCvfsS3Bucket(long id, Commvault.Powershell.Models.IUpdateCvfss3Bucket body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + (id.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateCvfsS3Bucket_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to update CVFS S3 Bucket properties and User Access</summary> /// <param name="viaIdentity"></param> /// <param name="body">UpdateCVFSS3Bucket</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateCvfsS3BucketViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateCvfss3Bucket body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CVFS/S3Bucket/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CVFS/S3Bucket/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + id ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateCvfsS3Bucket_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to update CVFS S3 Bucket properties and User Access</summary> /// <param name="viaIdentity"></param> /// <param name="body">UpdateCVFSS3Bucket</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> UpdateCvfsS3BucketViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateCvfss3Bucket body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CVFS/S3Bucket/(?<id>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CVFS/S3Bucket/{id}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + id ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateCvfsS3BucketWithResult_Call (request, eventListener,sender); } } /// <summary>Used to update CVFS S3 Bucket properties and User Access</summary> /// <param name="id">ID of the bucket</param> /// <param name="body">UpdateCVFSS3Bucket</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> UpdateCvfsS3BucketWithResult(long id, Commvault.Powershell.Models.IUpdateCvfss3Bucket body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + (id.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateCvfsS3BucketWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateCvfsS3BucketWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> UpdateCvfsS3BucketWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateCvfsS3Bucket" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateCvfsS3Bucket_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateCvfsS3Bucket" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="id">ID of the bucket</param> /// <param name="body">UpdateCVFSS3Bucket</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateCvfsS3Bucket_Validate(long id, Commvault.Powershell.Models.IUpdateCvfss3Bucket body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to modify an existing data classification plan</summary> /// <param name="planId">Id of the plan to fetch details</param> /// <param name="body">Describes Input to Update Data Classification Plan</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateDcPlan(long planId, Commvault.Powershell.Models.IUpdateDcPlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DCPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateDcPlan_Call (request, onOk,onBadRequest,onForbidden,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to modify an existing data classification plan</summary> /// <param name="viaIdentity"></param> /// <param name="body">Describes Input to Update Data Classification Plan</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateDcPlanViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateDcPlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/DCPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/DCPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DCPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateDcPlan_Call (request, onOk,onBadRequest,onForbidden,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to modify an existing data classification plan</summary> /// <param name="viaIdentity"></param> /// <param name="body">Describes Input to Update Data Classification Plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateDcPlanViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateDcPlan body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/DCPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/DCPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DCPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateDcPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Used to modify an existing data classification plan</summary> /// <param name="planId">Id of the plan to fetch details</param> /// <param name="body">Describes Input to Update Data Classification Plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateDcPlanWithResult(long planId, Commvault.Powershell.Models.IUpdateDcPlan body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DCPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateDcPlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateDcPlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateDcPlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateDcPlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateDcPlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateDcPlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the plan to fetch details</param> /// <param name="body">Describes Input to Update Data Classification Plan</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateDcPlan_Validate(long planId, Commvault.Powershell.Models.IUpdateDcPlan body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to modify a disk access path</summary> /// <param name="storagePoolId">Id of the disk storage pool whose access path has to be modified</param> /// <param name="backupLocationId">Id of the mount path whose access path has to be modified</param> /// <param name="accessPathId">Id of the mount path whose access path has to be modified</param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateDiskAccessPath(long storagePoolId, long backupLocationId, long accessPathId, Commvault.Powershell.Models.IUpdateDiskAccessPath body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath/" + (accessPathId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateDiskAccessPath_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to modify a disk access path</summary> /// <param name="viaIdentity"></param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateDiskAccessPathViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateDiskAccessPath body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath/(?<accessPathId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath/{accessPathId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; var accessPathId = _match.Groups["accessPathId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath/" + accessPathId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateDiskAccessPath_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to modify a disk access path</summary> /// <param name="viaIdentity"></param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateDiskAccessPathViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateDiskAccessPath body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath/(?<accessPathId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath/{accessPathId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; var accessPathId = _match.Groups["accessPathId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath/" + accessPathId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateDiskAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary>Used to modify a disk access path</summary> /// <param name="storagePoolId">Id of the disk storage pool whose access path has to be modified</param> /// <param name="backupLocationId">Id of the mount path whose access path has to be modified</param> /// <param name="accessPathId">Id of the mount path whose access path has to be modified</param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateDiskAccessPathWithResult(long storagePoolId, long backupLocationId, long accessPathId, Commvault.Powershell.Models.IUpdateDiskAccessPath body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath/" + (accessPathId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateDiskAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateDiskAccessPathWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateDiskAccessPathWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateDiskAccessPath" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateDiskAccessPath_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateDiskAccessPath" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the disk storage pool whose access path has to be modified</param> /// <param name="backupLocationId">Id of the mount path whose access path has to be modified</param> /// <param name="accessPathId">Id of the mount path whose access path has to be modified</param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateDiskAccessPath_Validate(long storagePoolId, long backupLocationId, long accessPathId, Commvault.Powershell.Models.IUpdateDiskAccessPath body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify the properties of an existing disk storage pool</summary> /// <param name="storagePoolId">Id of the disk storage to update</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateDiskStorage(long storagePoolId, Commvault.Powershell.Models.IUpdateDiskStorage body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateDiskStorage_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing disk storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateDiskStorageViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateDiskStorage body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateDiskStorage_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing disk storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateDiskStorageViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateDiskStorage body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Disk/(?<storagePoolId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Disk/{storagePoolId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + storagePoolId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateDiskStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Modify the properties of an existing disk storage pool</summary> /// <param name="storagePoolId">Id of the disk storage to update</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateDiskStorageWithResult(long storagePoolId, Commvault.Powershell.Models.IUpdateDiskStorage body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Disk/" + (storagePoolId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateDiskStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateDiskStorageWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateDiskStorageWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateDiskStorage" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateDiskStorage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateDiskStorage" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the disk storage to update</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateDiskStorage_Validate(long storagePoolId, Commvault.Powershell.Models.IUpdateDiskStorage body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify Backup Destination details for CommServe DR backups</summary> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateDrBackupDestinationDetails(long backupDestinationId, Commvault.Powershell.Models.IUpdatePlanBackupDestinationDetails body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DRBackup/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateDrBackupDestinationDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Modify Backup Destination details for CommServe DR backups</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateDrBackupDestinationDetailsViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdatePlanBackupDestinationDetails body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/DRBackup/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/DRBackup/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/DRBackup/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateDrBackupDestinationDetails_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateDrBackupDestinationDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateDrBackupDestinationDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateDrBackupDestinationDetails" /> method. Call this like the actual call, but you /// will get validation events back. /// </summary> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateDrBackupDestinationDetails_Validate(long backupDestinationId, Commvault.Powershell.Models.IUpdatePlanBackupDestinationDetails body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Update the SMTP server settings</summary> /// <param name="body">None of the fields are mandatory. whichever field is specified should be updated. Rest should be untouched.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateEmailServer(Commvault.Powershell.Models.IUpdateEmailServerReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onUnauthorized, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EmailServer" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateEmailServer_Call (request, onOk,onBadRequest,onUnauthorized,eventListener,sender); } } /// <summary>Update the SMTP server settings</summary> /// <param name="body">None of the fields are mandatory. whichever field is specified should be updated. Rest should be untouched.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateEmailServerWithResult(Commvault.Powershell.Models.IUpdateEmailServerReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EmailServer" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateEmailServerWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateEmailServerWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateEmailServerWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateEmailServer" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateEmailServer_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onUnauthorized, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onUnauthorized(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateEmailServer" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">None of the fields are mandatory. whichever field is specified should be updated. Rest should be untouched.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateEmailServer_Validate(Commvault.Powershell.Models.IUpdateEmailServerReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary> /// Modify entity settings used to change default behaviour for linked entity like servers or server groups /// </summary> /// <param name="body">ModifyEntitySettings</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateEntitySettings(Commvault.Powershell.Models.IModifyEntitySettings body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EntitySettings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateEntitySettings_Call (request, onOk,eventListener,sender); } } /// <summary> /// Modify entity settings used to change default behaviour for linked entity like servers or server groups /// </summary> /// <param name="body">ModifyEntitySettings</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateEntitySettingsWithResult(Commvault.Powershell.Models.IModifyEntitySettings body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/EntitySettings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateEntitySettingsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateEntitySettingsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateEntitySettingsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateEntitySettings" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateEntitySettings_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateEntitySettings" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">ModifyEntitySettings</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateEntitySettings_Validate(Commvault.Powershell.Models.IModifyEntitySettings body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to modify failover group</summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="body">Modify failover group request</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateFailoverGroup(long failoverGroupId, Commvault.Powershell.Models.IModifyFailoverGroupRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + (failoverGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateFailoverGroup_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>API to create failover group DR operation schedule</summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="scheduleId">ID of the DR operation schedule</param> /// <param name="body">Used to describe single plan schedule information</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateFailoverGroupSchedule(long failoverGroupId, long scheduleId, Commvault.Powershell.Models.IPlanSchedule body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + (failoverGroupId.ToString()) + "/Schedules/" + (scheduleId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateFailoverGroupSchedule_Call (request, onOk,onBadRequest,onServiceUnavailable,eventListener,sender); } } /// <summary>API to create failover group DR operation schedule</summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to describe single plan schedule information</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateFailoverGroupScheduleViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IPlanSchedule body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/FailoverGroups/(?<failoverGroupId>[^/]+)/Schedules/(?<scheduleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/FailoverGroups/{failoverGroupId}/Schedules/{scheduleId}'"); } // replace URI parameters with values from identity var failoverGroupId = _match.Groups["failoverGroupId"].Value; var scheduleId = _match.Groups["scheduleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + failoverGroupId + "/Schedules/" + scheduleId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateFailoverGroupSchedule_Call (request, onOk,onBadRequest,onServiceUnavailable,eventListener,sender); } } /// <summary>API to create failover group DR operation schedule</summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to describe single plan schedule information</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateFailoverGroupScheduleViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IPlanSchedule body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/FailoverGroups/(?<failoverGroupId>[^/]+)/Schedules/(?<scheduleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/FailoverGroups/{failoverGroupId}/Schedules/{scheduleId}'"); } // replace URI parameters with values from identity var failoverGroupId = _match.Groups["failoverGroupId"].Value; var scheduleId = _match.Groups["scheduleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + failoverGroupId + "/Schedules/" + scheduleId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateFailoverGroupScheduleWithResult_Call (request, eventListener,sender); } } /// <summary>API to create failover group DR operation schedule</summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="scheduleId">ID of the DR operation schedule</param> /// <param name="body">Used to describe single plan schedule information</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateFailoverGroupScheduleWithResult(long failoverGroupId, long scheduleId, Commvault.Powershell.Models.IPlanSchedule body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + (failoverGroupId.ToString()) + "/Schedules/" + (scheduleId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateFailoverGroupScheduleWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateFailoverGroupScheduleWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateFailoverGroupScheduleWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateFailoverGroupSchedule" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateFailoverGroupSchedule_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateFailoverGroupSchedule" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="scheduleId">ID of the DR operation schedule</param> /// <param name="body">Used to describe single plan schedule information</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateFailoverGroupSchedule_Validate(long failoverGroupId, long scheduleId, Commvault.Powershell.Models.IPlanSchedule body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to modify failover group</summary> /// <param name="viaIdentity"></param> /// <param name="body">Modify failover group request</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateFailoverGroupViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IModifyFailoverGroupRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/FailoverGroups/(?<failoverGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/FailoverGroups/{failoverGroupId}'"); } // replace URI parameters with values from identity var failoverGroupId = _match.Groups["failoverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + failoverGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateFailoverGroup_Call (request, onOk,onNotFound,onServiceUnavailable,eventListener,sender); } } /// <summary>API to modify failover group</summary> /// <param name="viaIdentity"></param> /// <param name="body">Modify failover group request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateFailoverGroupViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IModifyFailoverGroupRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/FailoverGroups/(?<failoverGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/FailoverGroups/{failoverGroupId}'"); } // replace URI parameters with values from identity var failoverGroupId = _match.Groups["failoverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + failoverGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateFailoverGroupWithResult_Call (request, eventListener,sender); } } /// <summary>API to modify failover group</summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="body">Modify failover group request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateFailoverGroupWithResult(long failoverGroupId, Commvault.Powershell.Models.IModifyFailoverGroupRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/FailoverGroups/" + (failoverGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateFailoverGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateFailoverGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateFailoverGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateFailoverGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onServiceUnavailable">a delegate that is called when the remote service returns 503 (ServiceUnavailable).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateFailoverGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onServiceUnavailable, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.ServiceUnavailable: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onServiceUnavailable(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateFailoverGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="failoverGroupId">Id of the failover group</param> /// <param name="body">Modify failover group request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateFailoverGroup_Validate(long failoverGroupId, Commvault.Powershell.Models.IModifyFailoverGroupRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Add/Edit/Delete global execptions</summary> /// <param name="body">Request body to be passed to the POST API</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateGlobalExceptions(Commvault.Powershell.Models.ISetGlobalExceptions body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GlobalExceptions" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateGlobalExceptions_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Add/Edit/Delete global execptions</summary> /// <param name="body">Request body to be passed to the POST API</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateGlobalExceptionsWithResult(Commvault.Powershell.Models.ISetGlobalExceptions body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GlobalExceptions" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateGlobalExceptionsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateGlobalExceptionsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateGlobalExceptionsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateGlobalExceptions" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateGlobalExceptions_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateGlobalExceptions" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Request body to be passed to the POST API</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateGlobalExceptions_Validate(Commvault.Powershell.Models.ISetGlobalExceptions body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify global settings used to override system default behaviour</summary> /// <param name="body">ModifyGlobalSettings</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateGlobalSettings(Commvault.Powershell.Models.IModifyGlobalSettings body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GlobalSettings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateGlobalSettings_Call (request, onOk,eventListener,sender); } } /// <summary>Modify global settings used to override system default behaviour</summary> /// <param name="body">ModifyGlobalSettings</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateGlobalSettingsWithResult(Commvault.Powershell.Models.IModifyGlobalSettings body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/GlobalSettings" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateGlobalSettingsWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateGlobalSettingsWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateGlobalSettingsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateGlobalSettings" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateGlobalSettings_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateGlobalSettings" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">ModifyGlobalSettings</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateGlobalSettings_Validate(Commvault.Powershell.Models.IModifyGlobalSettings body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify details like name, encryption, security of a specific hyperscale storage</summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="body">UpdateHyperScaleStorage</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateHyperScaleStorageById(long hyperScaleStorageId, Commvault.Powershell.Models.IUpdateHyperScaleStorage body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + (hyperScaleStorageId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateHyperScaleStorageById_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify details like name, encryption, security of a specific hyperscale storage</summary> /// <param name="viaIdentity"></param> /// <param name="body">UpdateHyperScaleStorage</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateHyperScaleStorageByIdViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateHyperScaleStorage body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/HyperScale/(?<hyperScaleStorageId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/HyperScale/{hyperScaleStorageId}'"); } // replace URI parameters with values from identity var hyperScaleStorageId = _match.Groups["hyperScaleStorageId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + hyperScaleStorageId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateHyperScaleStorageById_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify details like name, encryption, security of a specific hyperscale storage</summary> /// <param name="viaIdentity"></param> /// <param name="body">UpdateHyperScaleStorage</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateHyperScaleStorageByIdViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateHyperScaleStorage body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/HyperScale/(?<hyperScaleStorageId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/HyperScale/{hyperScaleStorageId}'"); } // replace URI parameters with values from identity var hyperScaleStorageId = _match.Groups["hyperScaleStorageId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + hyperScaleStorageId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateHyperScaleStorageByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Modify details like name, encryption, security of a specific hyperscale storage</summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="body">UpdateHyperScaleStorage</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateHyperScaleStorageByIdWithResult(long hyperScaleStorageId, Commvault.Powershell.Models.IUpdateHyperScaleStorage body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/HyperScale/" + (hyperScaleStorageId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateHyperScaleStorageByIdWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateHyperScaleStorageByIdWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateHyperScaleStorageByIdWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateHyperScaleStorageById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateHyperScaleStorageById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateHyperScaleStorageById" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="hyperScaleStorageId">Id of hyperscale storage</param> /// <param name="body">UpdateHyperScaleStorage</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateHyperScaleStorageById_Validate(long hyperScaleStorageId, Commvault.Powershell.Models.IUpdateHyperScaleStorage body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Update hypervisor filter details</summary> /// <param name="hypervisorId"></param> /// <param name="body">UpdateHypervisorFilterReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateHypervisorFilter(long hypervisorId, Commvault.Powershell.Models.IUpdateHypervisorFilterReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/hypervisor/" + (hypervisorId.ToString()) + "/filter" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateHypervisorFilter_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Update hypervisor filter details</summary> /// <param name="viaIdentity"></param> /// <param name="body">UpdateHypervisorFilterReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateHypervisorFilterViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateHypervisorFilterReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/v4/hypervisor/(?<hypervisorId>[^/]+)/filter$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/v4/hypervisor/{hypervisorId}/filter'"); } // replace URI parameters with values from identity var hypervisorId = _match.Groups["hypervisorId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/hypervisor/" + hypervisorId + "/filter" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateHypervisorFilter_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Update hypervisor filter details</summary> /// <param name="viaIdentity"></param> /// <param name="body">UpdateHypervisorFilterReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateHypervisorFilterViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateHypervisorFilterReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/v4/hypervisor/(?<hypervisorId>[^/]+)/filter$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/v4/hypervisor/{hypervisorId}/filter'"); } // replace URI parameters with values from identity var hypervisorId = _match.Groups["hypervisorId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/hypervisor/" + hypervisorId + "/filter" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateHypervisorFilterWithResult_Call (request, eventListener,sender); } } /// <summary>Update hypervisor filter details</summary> /// <param name="hypervisorId"></param> /// <param name="body">UpdateHypervisorFilterReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateHypervisorFilterWithResult(long hypervisorId, Commvault.Powershell.Models.IUpdateHypervisorFilterReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/v4/hypervisor/" + (hypervisorId.ToString()) + "/filter" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateHypervisorFilterWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateHypervisorFilterWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateHypervisorFilterWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateHypervisorFilter" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateHypervisorFilter_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateHypervisorFilter" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="hypervisorId"></param> /// <param name="body">UpdateHypervisorFilterReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateHypervisorFilter_Validate(long hypervisorId, Commvault.Powershell.Models.IUpdateHypervisorFilterReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to update properties of a Kubernetes application group</summary> /// <param name="applicationGroupId">applicationGroupId is the ID of the Kubernetes application group</param> /// <param name="body">Update Application Group Request</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateKubernetesAppGroupOp(long applicationGroupId, Commvault.Powershell.Models.IUpdateApplicationGroupRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + (applicationGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateKubernetesAppGroupOp_Call (request, onOk,eventListener,sender); } } /// <summary>API to update properties of a Kubernetes application group</summary> /// <param name="viaIdentity"></param> /// <param name="body">Update Application Group Request</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateKubernetesAppGroupOpViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateApplicationGroupRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/ApplicationGroup/(?<applicationGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/ApplicationGroup/{applicationGroupId}'"); } // replace URI parameters with values from identity var applicationGroupId = _match.Groups["applicationGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + applicationGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateKubernetesAppGroupOp_Call (request, onOk,eventListener,sender); } } /// <summary>API to update properties of a Kubernetes application group</summary> /// <param name="viaIdentity"></param> /// <param name="body">Update Application Group Request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateKubernetesAppGroupOpViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateApplicationGroupRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/ApplicationGroup/(?<applicationGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/ApplicationGroup/{applicationGroupId}'"); } // replace URI parameters with values from identity var applicationGroupId = _match.Groups["applicationGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + applicationGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateKubernetesAppGroupOpWithResult_Call (request, eventListener,sender); } } /// <summary>API to update properties of a Kubernetes application group</summary> /// <param name="applicationGroupId">applicationGroupId is the ID of the Kubernetes application group</param> /// <param name="body">Update Application Group Request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateKubernetesAppGroupOpWithResult(long applicationGroupId, Commvault.Powershell.Models.IUpdateApplicationGroupRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/ApplicationGroup/" + (applicationGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateKubernetesAppGroupOpWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateKubernetesAppGroupOpWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateKubernetesAppGroupOpWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateKubernetesAppGroupOp" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateKubernetesAppGroupOp_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateKubernetesAppGroupOp" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="applicationGroupId">applicationGroupId is the ID of the Kubernetes application group</param> /// <param name="body">Update Application Group Request</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateKubernetesAppGroupOp_Validate(long applicationGroupId, Commvault.Powershell.Models.IUpdateApplicationGroupRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to update the properties of a Kubernetes cluster with clusterId</summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="body">Request definition for creating Kubernetes cluster</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateKubernetesProperties(long clusterId, Commvault.Powershell.Models.IUpdateKubernetesClusterRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + (clusterId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateKubernetesProperties_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to update the properties of a Kubernetes cluster with clusterId</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request definition for creating Kubernetes cluster</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateKubernetesPropertiesViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateKubernetesClusterRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Cluster/(?<clusterId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Cluster/{clusterId}'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + clusterId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateKubernetesProperties_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>API to update the properties of a Kubernetes cluster with clusterId</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request definition for creating Kubernetes cluster</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateKubernetesPropertiesViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateKubernetesClusterRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V5/Kubernetes/Cluster/(?<clusterId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V5/Kubernetes/Cluster/{clusterId}'"); } // replace URI parameters with values from identity var clusterId = _match.Groups["clusterId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + clusterId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateKubernetesPropertiesWithResult_Call (request, eventListener,sender); } } /// <summary>API to update the properties of a Kubernetes cluster with clusterId</summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="body">Request definition for creating Kubernetes cluster</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateKubernetesPropertiesWithResult(long clusterId, Commvault.Powershell.Models.IUpdateKubernetesClusterRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V5/Kubernetes/Cluster/" + (clusterId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateKubernetesPropertiesWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateKubernetesPropertiesWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateKubernetesPropertiesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateKubernetesProperties" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateKubernetesProperties_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateKubernetesProperties" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="clusterId">clusterId is the ID of the Kubernetes cluster client</param> /// <param name="body">Request definition for creating Kubernetes cluster</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateKubernetesProperties_Validate(long clusterId, Commvault.Powershell.Models.IUpdateKubernetesClusterRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateLaptopBackupDestination(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdatePlanBackupDestination body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateLaptopBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Modify Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateLaptopBackupDestinationViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdatePlanBackupDestination body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateLaptopBackupDestination_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Modify Backup Destination for a Plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateLaptopBackupDestinationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdatePlanBackupDestination body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)/BackupDestination/(?<BackupDestinationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}/BackupDestination/{BackupDestinationId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; var backupDestinationId = _match.Groups["BackupDestinationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId + "/BackupDestination/" + backupDestinationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateLaptopBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary>Modify Backup Destination for a Plan</summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateLaptopBackupDestinationWithResult(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdatePlanBackupDestination body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) + "/BackupDestination/" + (backupDestinationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateLaptopBackupDestinationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateLaptopBackupDestinationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>" /> that will /// be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp> UpdateLaptopBackupDestinationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateLaptopBackupDestination" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateLaptopBackupDestination_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IPlanBackupDestinationResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.PlanBackupDestinationResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateLaptopBackupDestination" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="planId">Id of the Plan to modify</param> /// <param name="backupDestinationId">Id of the backupDestination to be modified</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateLaptopBackupDestination_Validate(long planId, long backupDestinationId, Commvault.Powershell.Models.IUpdatePlanBackupDestination body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify existing laptop plan details</summary> /// <param name="planId">Id of the plan</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateLaptopPlanById(long planId, Commvault.Powershell.Models.IUpdateLaptopPlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateLaptopPlanById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Modify existing laptop plan details</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateLaptopPlanByIdViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateLaptopPlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateLaptopPlanById_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Modify existing laptop plan details</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateLaptopPlanByIdViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateLaptopPlan body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/LaptopPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/LaptopPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateLaptopPlanByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Modify existing laptop plan details</summary> /// <param name="planId">Id of the plan</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateLaptopPlanByIdWithResult(long planId, Commvault.Powershell.Models.IUpdateLaptopPlan body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/LaptopPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateLaptopPlanByIdWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateLaptopPlanByIdWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateLaptopPlanByIdWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateLaptopPlanById" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateLaptopPlanById_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateLaptopPlanById" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the plan</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateLaptopPlanById_Validate(long planId, Commvault.Powershell.Models.IUpdateLaptopPlan body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to modify a local storage access path</summary> /// <param name="storagePoolId">Id of the Local storage pool whose access path has to be modified</param> /// <param name="backupLocationId">Id of the mount path whose access path has to be modified</param> /// <param name="accessPathId">Id of the mount path whose access path has to be modified</param> /// <param name="body">Used to update access path</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateLocalAccessPath(long storagePoolId, long backupLocationId, long accessPathId, Commvault.Powershell.Models.IUpdateLocalAccessPath body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath/" + (accessPathId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateLocalAccessPath_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to modify a local storage access path</summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to update access path</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateLocalAccessPathViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateLocalAccessPath body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath/(?<accessPathId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath/{accessPathId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; var accessPathId = _match.Groups["accessPathId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath/" + accessPathId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateLocalAccessPath_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to modify a local storage access path</summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to update access path</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateLocalAccessPathViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateLocalAccessPath body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)/AccessPath/(?<accessPathId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation/{backupLocationId}/AccessPath/{accessPathId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; var accessPathId = _match.Groups["accessPathId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation/" + backupLocationId + "/AccessPath/" + accessPathId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateLocalAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary>Used to modify a local storage access path</summary> /// <param name="storagePoolId">Id of the Local storage pool whose access path has to be modified</param> /// <param name="backupLocationId">Id of the mount path whose access path has to be modified</param> /// <param name="accessPathId">Id of the mount path whose access path has to be modified</param> /// <param name="body">Used to update access path</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateLocalAccessPathWithResult(long storagePoolId, long backupLocationId, long accessPathId, Commvault.Powershell.Models.IUpdateLocalAccessPath body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) + "/AccessPath/" + (accessPathId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateLocalAccessPathWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateLocalAccessPathWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateLocalAccessPathWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateLocalAccessPath" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateLocalAccessPath_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateLocalAccessPath" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the Local storage pool whose access path has to be modified</param> /// <param name="backupLocationId">Id of the mount path whose access path has to be modified</param> /// <param name="accessPathId">Id of the mount path whose access path has to be modified</param> /// <param name="body">Used to update access path</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateLocalAccessPath_Validate(long storagePoolId, long backupLocationId, long accessPathId, Commvault.Powershell.Models.IUpdateLocalAccessPath body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify the properties of an existing mount path of local storage pool</summary> /// <param name="storagePoolId">Id of the local storage pool to update</param> /// <param name="backupLocationId">Id of the backup location to update</param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateLocalBackupLocation(long storagePoolId, long backupLocationId, Commvault.Powershell.Models.IUpdateBackupLocation body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateLocalBackupLocation_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing mount path of local storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateLocalBackupLocationViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateBackupLocation body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation/{backupLocationId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation/" + backupLocationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateLocalBackupLocation_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing mount path of local storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateLocalBackupLocationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateBackupLocation body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)/BackupLocation/(?<backupLocationId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}/BackupLocation/{backupLocationId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; var backupLocationId = _match.Groups["backupLocationId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId + "/BackupLocation/" + backupLocationId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateLocalBackupLocationWithResult_Call (request, eventListener,sender); } } /// <summary>Modify the properties of an existing mount path of local storage pool</summary> /// <param name="storagePoolId">Id of the local storage pool to update</param> /// <param name="backupLocationId">Id of the backup location to update</param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateLocalBackupLocationWithResult(long storagePoolId, long backupLocationId, Commvault.Powershell.Models.IUpdateBackupLocation body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) + "/BackupLocation/" + (backupLocationId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateLocalBackupLocationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateLocalBackupLocationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateLocalBackupLocationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateLocalBackupLocation" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateLocalBackupLocation_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateLocalBackupLocation" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="storagePoolId">Id of the local storage pool to update</param> /// <param name="backupLocationId">Id of the backup location to update</param> /// <param name="body">While adding network access path, please add credentials or saved credentials. If both are provided, /// credentials will be selected.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateLocalBackupLocation_Validate(long storagePoolId, long backupLocationId, Commvault.Powershell.Models.IUpdateBackupLocation body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify the properties of an existing local storage pool</summary> /// <param name="storagePoolId">Id of the local storage to update</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateLocalStorage(long storagePoolId, Commvault.Powershell.Models.IUpdateLocalStorage body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateLocalStorage_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing local storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateLocalStorageViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateLocalStorage body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateLocalStorage_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing local storage pool</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateLocalStorageViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateLocalStorage body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Storage/Local/(?<storagePoolId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Storage/Local/{storagePoolId}'"); } // replace URI parameters with values from identity var storagePoolId = _match.Groups["storagePoolId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + storagePoolId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateLocalStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Modify the properties of an existing local storage pool</summary> /// <param name="storagePoolId">Id of the local storage to update</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateLocalStorageWithResult(long storagePoolId, Commvault.Powershell.Models.IUpdateLocalStorage body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Storage/Local/" + (storagePoolId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateLocalStorageWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateLocalStorageWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateLocalStorageWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateLocalStorage" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateLocalStorage_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateLocalStorage" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="storagePoolId">Id of the local storage to update</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateLocalStorage_Validate(long storagePoolId, Commvault.Powershell.Models.IUpdateLocalStorage body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify the properties of an existing media agent</summary> /// <param name="mediaAgentId">Id of the mediaAgent to update</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateMediaAgent(long mediaAgentId, Commvault.Powershell.Models.IUpdateMediaAgent body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + (mediaAgentId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateMediaAgent_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing media agent</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateMediaAgentViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateMediaAgent body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/mediaAgent/(?<mediaAgentId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/mediaAgent/{mediaAgentId}'"); } // replace URI parameters with values from identity var mediaAgentId = _match.Groups["mediaAgentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + mediaAgentId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateMediaAgent_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing media agent</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateMediaAgentViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateMediaAgent body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/mediaAgent/(?<mediaAgentId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/mediaAgent/{mediaAgentId}'"); } // replace URI parameters with values from identity var mediaAgentId = _match.Groups["mediaAgentId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + mediaAgentId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateMediaAgentWithResult_Call (request, eventListener,sender); } } /// <summary>Modify the properties of an existing media agent</summary> /// <param name="mediaAgentId">Id of the mediaAgent to update</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateMediaAgentWithResult(long mediaAgentId, Commvault.Powershell.Models.IUpdateMediaAgent body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/mediaAgent/" + (mediaAgentId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateMediaAgentWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateMediaAgentWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateMediaAgentWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateMediaAgent" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateMediaAgent_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateMediaAgent" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="mediaAgentId">Id of the mediaAgent to update</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateMediaAgent_Validate(long mediaAgentId, Commvault.Powershell.Models.IUpdateMediaAgent body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to modify an exsiting ObjectStore plan</summary> /// <param name="planId">Id of the Plan to update</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateObjectStorePlan(long planId, Commvault.Powershell.Models.IUpdateObjectStorePlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ObjectStorePlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateObjectStorePlan_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to modify an exsiting ObjectStore plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateObjectStorePlanViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateObjectStorePlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ObjectStorePlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ObjectStorePlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ObjectStorePlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateObjectStorePlan_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to modify an exsiting ObjectStore plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateObjectStorePlanViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateObjectStorePlan body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ObjectStorePlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ObjectStorePlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ObjectStorePlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateObjectStorePlanWithResult_Call (request, eventListener,sender); } } /// <summary>Used to modify an exsiting ObjectStore plan</summary> /// <param name="planId">Id of the Plan to update</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateObjectStorePlanWithResult(long planId, Commvault.Powershell.Models.IUpdateObjectStorePlan body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ObjectStorePlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateObjectStorePlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateObjectStorePlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateObjectStorePlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateObjectStorePlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateObjectStorePlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateObjectStorePlan" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the Plan to update</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateObjectStorePlan_Validate(long planId, Commvault.Powershell.Models.IUpdateObjectStorePlan body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to modify an exsiting server plan</summary> /// <param name="planId">Id of the Plan to update</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdatePlan(long planId, Commvault.Powershell.Models.IUpdateServerPlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdatePlan_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary> /// Api to update existing plan rules. Request body will suggest which rule need to be updated and type of entities(workloads /// type, server groups, regions and all) that need to be referenced for applying that rule against a workload. /// </summary> /// <param name="body">Plan entity rule update object. Fields in this object need to be populated to suggest what need to /// be changed in the rule. /// User can provide all rule options or can specify a specific rule group. Be default, for rule to be applicable for association /// to a workload, ALL specified rules in that Rule need to be matched.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdatePlanRule(Commvault.Powershell.Models.IUpdatePlanEntityRule body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdatePlanRule_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>API to update rank for multiple rules at a time.</summary> /// <param name="body">Plan entity rule update rank object. Fields in this object need to be populated to suggest what rank /// need to be set for the said rule.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdatePlanRuleRank(Commvault.Powershell.Models.IUpdatePlanEntityRuleRanks body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/Rank" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdatePlanRuleRank_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>API to update rank for multiple rules at a time.</summary> /// <param name="body">Plan entity rule update rank object. Fields in this object need to be populated to suggest what rank /// need to be set for the said rule.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdatePlanRuleRankWithResult(Commvault.Powershell.Models.IUpdatePlanEntityRuleRanks body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule/Rank" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdatePlanRuleRankWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdatePlanRuleRankWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdatePlanRuleRankWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdatePlanRuleRank" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdatePlanRuleRank_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdatePlanRuleRank" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Plan entity rule update rank object. Fields in this object need to be populated to suggest what rank /// need to be set for the said rule.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdatePlanRuleRank_Validate(Commvault.Powershell.Models.IUpdatePlanEntityRuleRanks body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary> /// Api to update existing plan rules. Request body will suggest which rule need to be updated and type of entities(workloads /// type, server groups, regions and all) that need to be referenced for applying that rule against a workload. /// </summary> /// <param name="body">Plan entity rule update object. Fields in this object need to be populated to suggest what need to /// be changed in the rule. /// User can provide all rule options or can specify a specific rule group. Be default, for rule to be applicable for association /// to a workload, ALL specified rules in that Rule need to be matched.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdatePlanRuleWithResult(Commvault.Powershell.Models.IUpdatePlanEntityRule body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Plan/Rule" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdatePlanRuleWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdatePlanRuleWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdatePlanRuleWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdatePlanRule" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdatePlanRule_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdatePlanRule" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Plan entity rule update object. Fields in this object need to be populated to suggest what need to /// be changed in the rule. /// User can provide all rule options or can specify a specific rule group. Be default, for rule to be applicable for association /// to a workload, ALL specified rules in that Rule need to be matched.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdatePlanRule_Validate(Commvault.Powershell.Models.IUpdatePlanEntityRule body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to modify an exsiting server plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdatePlanViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateServerPlan body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdatePlan_Call (request, onOk,onNotFound,eventListener,sender); } } /// <summary>Used to modify an exsiting server plan</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdatePlanViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateServerPlan body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdatePlanWithResult_Call (request, eventListener,sender); } } /// <summary>Used to modify an exsiting server plan</summary> /// <param name="planId">Id of the Plan to update</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdatePlanWithResult(long planId, Commvault.Powershell.Models.IUpdateServerPlan body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdatePlanWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdatePlanWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdatePlanWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdatePlan" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdatePlan_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdatePlan" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="planId">Id of the Plan to update</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdatePlan_Validate(long planId, Commvault.Powershell.Models.IUpdateServerPlan body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Updating recovery entities in the recovery group</summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="body">AddUpdateRecoveryEntityRequest</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateRecoveryEntities(long recoveryGroupId, Commvault.Powershell.Models.IAddUpdateRecoveryEntityRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + (recoveryGroupId.ToString()) + "/Entity" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateRecoveryEntities_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Updating recovery entities in the recovery group</summary> /// <param name="viaIdentity"></param> /// <param name="body">AddUpdateRecoveryEntityRequest</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateRecoveryEntitiesViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IAddUpdateRecoveryEntityRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/RecoveryGroup/(?<recoveryGroupId>[^/]+)/Entity$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryGroup/{recoveryGroupId}/Entity'"); } // replace URI parameters with values from identity var recoveryGroupId = _match.Groups["recoveryGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + recoveryGroupId + "/Entity" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateRecoveryEntities_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Updating recovery entities in the recovery group</summary> /// <param name="viaIdentity"></param> /// <param name="body">AddUpdateRecoveryEntityRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateRecoveryEntitiesViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IAddUpdateRecoveryEntityRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/RecoveryGroup/(?<recoveryGroupId>[^/]+)/Entity$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryGroup/{recoveryGroupId}/Entity'"); } // replace URI parameters with values from identity var recoveryGroupId = _match.Groups["recoveryGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + recoveryGroupId + "/Entity" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateRecoveryEntitiesWithResult_Call (request, eventListener,sender); } } /// <summary>Updating recovery entities in the recovery group</summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="body">AddUpdateRecoveryEntityRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateRecoveryEntitiesWithResult(long recoveryGroupId, Commvault.Powershell.Models.IAddUpdateRecoveryEntityRequest body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + (recoveryGroupId.ToString()) + "/Entity" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateRecoveryEntitiesWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateRecoveryEntitiesWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateRecoveryEntitiesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateRecoveryEntities" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateRecoveryEntities_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateRecoveryEntities" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="body">AddUpdateRecoveryEntityRequest</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateRecoveryEntities_Validate(long recoveryGroupId, Commvault.Powershell.Models.IAddUpdateRecoveryEntityRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Updating the entity in the recovery group</summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="entityId">Recovery entity Id</param> /// <param name="body">The payload for the creation of recovery entity</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateRecoveryEntity(long recoveryGroupId, long entityId, Commvault.Powershell.Models.IRecoveryEntity body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + (recoveryGroupId.ToString()) + "/Entity/" + (entityId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateRecoveryEntity_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Updating the entity in the recovery group</summary> /// <param name="viaIdentity"></param> /// <param name="body">The payload for the creation of recovery entity</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateRecoveryEntityViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IRecoveryEntity body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/RecoveryGroup/(?<recoveryGroupId>[^/]+)/Entity/(?<entityId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryGroup/{recoveryGroupId}/Entity/{entityId}'"); } // replace URI parameters with values from identity var recoveryGroupId = _match.Groups["recoveryGroupId"].Value; var entityId = _match.Groups["entityId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + recoveryGroupId + "/Entity/" + entityId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateRecoveryEntity_Call (request, onOk,onBadRequest,eventListener,sender); } } /// <summary>Updating the entity in the recovery group</summary> /// <param name="viaIdentity"></param> /// <param name="body">The payload for the creation of recovery entity</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateRecoveryEntityViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IRecoveryEntity body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/RecoveryGroup/(?<recoveryGroupId>[^/]+)/Entity/(?<entityId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryGroup/{recoveryGroupId}/Entity/{entityId}'"); } // replace URI parameters with values from identity var recoveryGroupId = _match.Groups["recoveryGroupId"].Value; var entityId = _match.Groups["entityId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + recoveryGroupId + "/Entity/" + entityId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateRecoveryEntityWithResult_Call (request, eventListener,sender); } } /// <summary>Updating the entity in the recovery group</summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="entityId">Recovery entity Id</param> /// <param name="body">The payload for the creation of recovery entity</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateRecoveryEntityWithResult(long recoveryGroupId, long entityId, Commvault.Powershell.Models.IRecoveryEntity body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + (recoveryGroupId.ToString()) + "/Entity/" + (entityId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateRecoveryEntityWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateRecoveryEntityWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateRecoveryEntityWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateRecoveryEntity" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateRecoveryEntity_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateRecoveryEntity" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="entityId">Recovery entity Id</param> /// <param name="body">The payload for the creation of recovery entity</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateRecoveryEntity_Validate(long recoveryGroupId, long entityId, Commvault.Powershell.Models.IRecoveryEntity body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Update Recovery Group</summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="body">Model to provide basic detail of recovery group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateRecoveryGroup(long recoveryGroupId, Commvault.Powershell.Models.IRecoveryGroup body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + (recoveryGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateRecoveryGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Update Recovery Group</summary> /// <param name="viaIdentity"></param> /// <param name="body">Model to provide basic detail of recovery group</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateRecoveryGroupViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IRecoveryGroup body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/RecoveryGroup/(?<recoveryGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryGroup/{recoveryGroupId}'"); } // replace URI parameters with values from identity var recoveryGroupId = _match.Groups["recoveryGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + recoveryGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateRecoveryGroup_Call (request, onOk,eventListener,sender); } } /// <summary>Update Recovery Group</summary> /// <param name="viaIdentity"></param> /// <param name="body">Model to provide basic detail of recovery group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp> UpdateRecoveryGroupViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IRecoveryGroup body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/RecoveryGroup/(?<recoveryGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/RecoveryGroup/{recoveryGroupId}'"); } // replace URI parameters with values from identity var recoveryGroupId = _match.Groups["recoveryGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + recoveryGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateRecoveryGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Update Recovery Group</summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="body">Model to provide basic detail of recovery group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>" /> that will be /// complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp> UpdateRecoveryGroupWithResult(long recoveryGroupId, Commvault.Powershell.Models.IRecoveryGroup body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/RecoveryGroup/" + (recoveryGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateRecoveryGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateRecoveryGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>" /> that will be /// complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp> UpdateRecoveryGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateRecoveryGroupResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateRecoveryGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateRecoveryGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateRecoveryGroupResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateRecoveryGroupResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateRecoveryGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="recoveryGroupId">Recovery group Id</param> /// <param name="body">Model to provide basic detail of recovery group</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateRecoveryGroup_Validate(long recoveryGroupId, Commvault.Powershell.Models.IRecoveryGroup body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Update details of the region</summary> /// <param name="regionId"></param> /// <param name="body">Properties to be updated for the region</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateRegion(long regionId, Commvault.Powershell.Models.IUpdateRegion body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions/" + (regionId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateRegion_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Update details of the region</summary> /// <param name="viaIdentity"></param> /// <param name="body">Properties to be updated for the region</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateRegionViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateRegion body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Regions/(?<regionId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Regions/{regionId}'"); } // replace URI parameters with values from identity var regionId = _match.Groups["regionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions/" + regionId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateRegion_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Update details of the region</summary> /// <param name="viaIdentity"></param> /// <param name="body">Properties to be updated for the region</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateRegionViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateRegion body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Regions/(?<regionId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Regions/{regionId}'"); } // replace URI parameters with values from identity var regionId = _match.Groups["regionId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions/" + regionId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateRegionWithResult_Call (request, eventListener,sender); } } /// <summary>Update details of the region</summary> /// <param name="regionId"></param> /// <param name="body">Properties to be updated for the region</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateRegionWithResult(long regionId, Commvault.Powershell.Models.IUpdateRegion body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Regions/" + (regionId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateRegionWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateRegionWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateRegionWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateRegion" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateRegion_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateRegion" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="regionId"></param> /// <param name="body">Properties to be updated for the region</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateRegion_Validate(long regionId, Commvault.Powershell.Models.IUpdateRegion body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify the properties of an existing replication group</summary> /// <param name="replicationGroupId"></param> /// <param name="body">UpdateReplicationGroupReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateReplicationGroup(string replicationGroupId, Commvault.Powershell.Models.IUpdateReplicationGroup body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ReplicationGroup/" + global::System.Uri.EscapeDataString(replicationGroupId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateReplicationGroup_Call (request, onOk,onBadRequest,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Modify the properties of an existing replication group</summary> /// <param name="viaIdentity"></param> /// <param name="body">UpdateReplicationGroupReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateReplicationGroupViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateReplicationGroup body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ReplicationGroup/(?<replicationGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ReplicationGroup/{replicationGroupId}'"); } // replace URI parameters with values from identity var replicationGroupId = _match.Groups["replicationGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ReplicationGroup/" + replicationGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateReplicationGroup_Call (request, onOk,onBadRequest,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Modify the properties of an existing replication group</summary> /// <param name="viaIdentity"></param> /// <param name="body">UpdateReplicationGroupReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateReplicationGroupViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateReplicationGroup body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ReplicationGroup/(?<replicationGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ReplicationGroup/{replicationGroupId}'"); } // replace URI parameters with values from identity var replicationGroupId = _match.Groups["replicationGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ReplicationGroup/" + replicationGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateReplicationGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Modify the properties of an existing replication group</summary> /// <param name="replicationGroupId"></param> /// <param name="body">UpdateReplicationGroupReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateReplicationGroupWithResult(string replicationGroupId, Commvault.Powershell.Models.IUpdateReplicationGroup body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ReplicationGroup/" + global::System.Uri.EscapeDataString(replicationGroupId) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateReplicationGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateReplicationGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateReplicationGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateReplicationGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateReplicationGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateReplicationGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="replicationGroupId"></param> /// <param name="body">UpdateReplicationGroupReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateReplicationGroup_Validate(string replicationGroupId, Commvault.Powershell.Models.IUpdateReplicationGroup body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(replicationGroupId),replicationGroupId); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify the properties of an existing role</summary> /// <param name="roleId">Role Id</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateRole(long roleId, Commvault.Powershell.Models.IUpdateRole body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role/" + (roleId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateRole_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing role</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateRoleViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateRole body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Role/(?<roleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Role/{roleId}'"); } // replace URI parameters with values from identity var roleId = _match.Groups["roleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role/" + roleId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateRole_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing role</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateRoleViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateRole body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/Role/(?<roleId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/Role/{roleId}'"); } // replace URI parameters with values from identity var roleId = _match.Groups["roleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role/" + roleId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateRoleWithResult_Call (request, eventListener,sender); } } /// <summary>Modify the properties of an existing role</summary> /// <param name="roleId">Role Id</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateRoleWithResult(long roleId, Commvault.Powershell.Models.IUpdateRole body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/Role/" + (roleId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateRoleWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateRoleWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateRoleWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateRole" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateRole_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateRole" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="roleId">Role Id</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateRole_Validate(long roleId, Commvault.Powershell.Models.IUpdateRole body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Update the bucket clone properties</summary> /// <param name="id">ID of the bucket</param> /// <param name="cloneId">ID of the cloned bucket</param> /// <param name="body">UpdateCVFSS3CloneExpiryTime</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateS3BucketCloneExpiry(long id, long cloneId, Commvault.Powershell.Models.IUpdateCvfss3CloneReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + (id.ToString()) + "/Clone/" + (cloneId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateS3BucketCloneExpiry_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Update the bucket clone properties</summary> /// <param name="viaIdentity"></param> /// <param name="body">UpdateCVFSS3CloneExpiryTime</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateS3BucketCloneExpiryViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateCvfss3CloneReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CVFS/S3Bucket/(?<id>[^/]+)/Clone/(?<cloneId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CVFS/S3Bucket/{id}/Clone/{cloneId}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; var cloneId = _match.Groups["cloneId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + id + "/Clone/" + cloneId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateS3BucketCloneExpiry_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Update the bucket clone properties</summary> /// <param name="viaIdentity"></param> /// <param name="body">UpdateCVFSS3CloneExpiryTime</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> UpdateS3BucketCloneExpiryViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateCvfss3CloneReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/CVFS/S3Bucket/(?<id>[^/]+)/Clone/(?<cloneId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/CVFS/S3Bucket/{id}/Clone/{cloneId}'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; var cloneId = _match.Groups["cloneId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + id + "/Clone/" + cloneId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateS3BucketCloneExpiryWithResult_Call (request, eventListener,sender); } } /// <summary>Update the bucket clone properties</summary> /// <param name="id">ID of the bucket</param> /// <param name="cloneId">ID of the cloned bucket</param> /// <param name="body">UpdateCVFSS3CloneExpiryTime</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> UpdateS3BucketCloneExpiryWithResult(long id, long cloneId, Commvault.Powershell.Models.IUpdateCvfss3CloneReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/CVFS/S3Bucket/" + (id.ToString()) + "/Clone/" + (cloneId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateS3BucketCloneExpiryWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateS3BucketCloneExpiryWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> UpdateS3BucketCloneExpiryWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateS3BucketCloneExpiry" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateS3BucketCloneExpiry_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateS3BucketCloneExpiry" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="id">ID of the bucket</param> /// <param name="cloneId">ID of the cloned bucket</param> /// <param name="body">UpdateCVFSS3CloneExpiryTime</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateS3BucketCloneExpiry_Validate(long id, long cloneId, Commvault.Powershell.Models.IUpdateCvfss3CloneReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Update details of existing SAML app</summary> /// <param name="name"></param> /// <param name="body">Updates SAML details</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateSamlApp(string name, Commvault.Powershell.Models.ISamlUpdate body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SAML/" + global::System.Uri.EscapeDataString(name) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateSamlApp_Call (request, onOk,eventListener,sender); } } /// <summary>Update details of existing SAML app</summary> /// <param name="viaIdentity"></param> /// <param name="body">Updates SAML details</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateSamlAppViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.ISamlUpdate body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/SAML/(?<name>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/SAML/{name}'"); } // replace URI parameters with values from identity var name = _match.Groups["name"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SAML/" + name ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateSamlApp_Call (request, onOk,eventListener,sender); } } /// <summary>Update details of existing SAML app</summary> /// <param name="viaIdentity"></param> /// <param name="body">Updates SAML details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateSamlAppViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.ISamlUpdate body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/SAML/(?<name>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/SAML/{name}'"); } // replace URI parameters with values from identity var name = _match.Groups["name"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SAML/" + name ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateSamlAppWithResult_Call (request, eventListener,sender); } } /// <summary>Update details of existing SAML app</summary> /// <param name="name"></param> /// <param name="body">Updates SAML details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateSamlAppWithResult(string name, Commvault.Powershell.Models.ISamlUpdate body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SAML/" + global::System.Uri.EscapeDataString(name) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateSamlAppWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateSamlAppWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateSamlAppWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateSamlApp" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateSamlApp_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateSamlApp" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="name"></param> /// <param name="body">Updates SAML details</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateSamlApp_Validate(string name, Commvault.Powershell.Models.ISamlUpdate body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(name),name); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to update pattern for schedule in schedule policy</summary> /// <param name="schedulePolicyId"></param> /// <param name="scheduleId"></param> /// <param name="body">If updating pattern, the value which needs to be retained also needs to be provided along with the /// updated value</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateSchedulePattern(long schedulePolicyId, long scheduleId, Commvault.Powershell.Models.IPlanPattern body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SchedulePolicy/" + (schedulePolicyId.ToString()) + "/Schedule/" + (scheduleId.ToString()) + "/Pattern" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateSchedulePattern_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>API to update pattern for schedule in schedule policy</summary> /// <param name="viaIdentity"></param> /// <param name="body">If updating pattern, the value which needs to be retained also needs to be provided along with the /// updated value</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateSchedulePatternViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IPlanPattern body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/SchedulePolicy/(?<schedulePolicyId>[^/]+)/Schedule/(?<scheduleId>[^/]+)/Pattern$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/SchedulePolicy/{schedulePolicyId}/Schedule/{scheduleId}/Pattern'"); } // replace URI parameters with values from identity var schedulePolicyId = _match.Groups["schedulePolicyId"].Value; var scheduleId = _match.Groups["scheduleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SchedulePolicy/" + schedulePolicyId + "/Schedule/" + scheduleId + "/Pattern" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateSchedulePattern_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>API to update pattern for schedule in schedule policy</summary> /// <param name="viaIdentity"></param> /// <param name="body">If updating pattern, the value which needs to be retained also needs to be provided along with the /// updated value</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateSchedulePatternViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IPlanPattern body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/SchedulePolicy/(?<schedulePolicyId>[^/]+)/Schedule/(?<scheduleId>[^/]+)/Pattern$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/SchedulePolicy/{schedulePolicyId}/Schedule/{scheduleId}/Pattern'"); } // replace URI parameters with values from identity var schedulePolicyId = _match.Groups["schedulePolicyId"].Value; var scheduleId = _match.Groups["scheduleId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SchedulePolicy/" + schedulePolicyId + "/Schedule/" + scheduleId + "/Pattern" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateSchedulePatternWithResult_Call (request, eventListener,sender); } } /// <summary>API to update pattern for schedule in schedule policy</summary> /// <param name="schedulePolicyId"></param> /// <param name="scheduleId"></param> /// <param name="body">If updating pattern, the value which needs to be retained also needs to be provided along with the /// updated value</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateSchedulePatternWithResult(long schedulePolicyId, long scheduleId, Commvault.Powershell.Models.IPlanPattern body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SchedulePolicy/" + (schedulePolicyId.ToString()) + "/Schedule/" + (scheduleId.ToString()) + "/Pattern" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateSchedulePatternWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateSchedulePatternWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateSchedulePatternWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateSchedulePattern" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateSchedulePattern_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateSchedulePattern" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="schedulePolicyId"></param> /// <param name="scheduleId"></param> /// <param name="body">If updating pattern, the value which needs to be retained also needs to be provided along with the /// updated value</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateSchedulePattern_Validate(long schedulePolicyId, long scheduleId, Commvault.Powershell.Models.IPlanPattern body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to update server associations for a server group</summary> /// <param name="serverGroupId">Id of the serverGroupId whose details have to be fetched</param> /// <param name="body">Update server group, operation supported for three ServerGroupTypes MANUAL, AUTOMATIC, VIRTUAL_MACHINE</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateServerGroupAssociation(long serverGroupId, Commvault.Powershell.Models.IUpdateServerGroup body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateServerGroupAssociation_Call (request, onOk,onBadRequest,onForbidden,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to update server associations for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="body">Update server group, operation supported for three ServerGroupTypes MANUAL, AUTOMATIC, VIRTUAL_MACHINE</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateServerGroupAssociationViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateServerGroup body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateServerGroupAssociation_Call (request, onOk,onBadRequest,onForbidden,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Used to update server associations for a server group</summary> /// <param name="viaIdentity"></param> /// <param name="body">Update server group, operation supported for three ServerGroupTypes MANUAL, AUTOMATIC, VIRTUAL_MACHINE</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateServerGroupAssociationViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateServerGroup body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerGroup/(?<serverGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerGroup/{serverGroupId}'"); } // replace URI parameters with values from identity var serverGroupId = _match.Groups["serverGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + serverGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateServerGroupAssociationWithResult_Call (request, eventListener,sender); } } /// <summary>Used to update server associations for a server group</summary> /// <param name="serverGroupId">Id of the serverGroupId whose details have to be fetched</param> /// <param name="body">Update server group, operation supported for three ServerGroupTypes MANUAL, AUTOMATIC, VIRTUAL_MACHINE</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateServerGroupAssociationWithResult(long serverGroupId, Commvault.Powershell.Models.IUpdateServerGroup body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerGroup/" + (serverGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateServerGroupAssociationWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateServerGroupAssociationWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateServerGroupAssociationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateServerGroupAssociation" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateServerGroupAssociation_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateServerGroupAssociation" /> method. Call this like the actual call, but you will /// get validation events back. /// </summary> /// <param name="serverGroupId">Id of the serverGroupId whose details have to be fetched</param> /// <param name="body">Update server group, operation supported for three ServerGroupTypes MANUAL, AUTOMATIC, VIRTUAL_MACHINE</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateServerGroupAssociation_Validate(long serverGroupId, Commvault.Powershell.Models.IUpdateServerGroup body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>API to modify RPO schedules on server plan</summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="body">Modify the schedules for the backup jobs.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateServerPlanRpo(long planId, Commvault.Powershell.Models.IServerPlanUpdateSchedules body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/RPO" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateServerPlanRpo_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>API to modify RPO schedules on server plan</summary> /// <param name="viaIdentity"></param> /// <param name="body">Modify the schedules for the backup jobs.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateServerPlanRpoViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IServerPlanUpdateSchedules body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/RPO$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/RPO'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/RPO" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateServerPlanRpo_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>API to modify RPO schedules on server plan</summary> /// <param name="viaIdentity"></param> /// <param name="body">Modify the schedules for the backup jobs.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateServerPlanRpoViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IServerPlanUpdateSchedules body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/ServerPlan/(?<planId>[^/]+)/RPO$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/ServerPlan/{planId}/RPO'"); } // replace URI parameters with values from identity var planId = _match.Groups["planId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + planId + "/RPO" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateServerPlanRpoWithResult_Call (request, eventListener,sender); } } /// <summary>API to modify RPO schedules on server plan</summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="body">Modify the schedules for the backup jobs.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateServerPlanRpoWithResult(long planId, Commvault.Powershell.Models.IServerPlanUpdateSchedules body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/ServerPlan/" + (planId.ToString()) + "/RPO" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateServerPlanRpoWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateServerPlanRpoWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateServerPlanRpoWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateServerPlanRpo" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateServerPlanRpo_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateServerPlanRpo" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="planId">Id of the Server Plan</param> /// <param name="body">Modify the schedules for the backup jobs.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateServerPlanRpo_Validate(long planId, Commvault.Powershell.Models.IServerPlanUpdateSchedules body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify software cache details</summary> /// <param name="clientId">Software cache client id</param> /// <param name="body">Request to update software cache properties like associations, cache directory or enabled for a specific /// server.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateSoftwareCacheDetails(long clientId, Commvault.Powershell.Models.IModifySoftwareCacheDetails body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SoftwareCache/" + (clientId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateSoftwareCacheDetails_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Modify software cache details</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request to update software cache properties like associations, cache directory or enabled for a specific /// server.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateSoftwareCacheDetailsViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IModifySoftwareCacheDetails body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/SoftwareCache/(?<clientId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/SoftwareCache/{clientId}'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SoftwareCache/" + clientId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateSoftwareCacheDetails_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Modify software cache details</summary> /// <param name="viaIdentity"></param> /// <param name="body">Request to update software cache properties like associations, cache directory or enabled for a specific /// server.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateSoftwareCacheDetailsViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IModifySoftwareCacheDetails body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/SoftwareCache/(?<clientId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/SoftwareCache/{clientId}'"); } // replace URI parameters with values from identity var clientId = _match.Groups["clientId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SoftwareCache/" + clientId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateSoftwareCacheDetailsWithResult_Call (request, eventListener,sender); } } /// <summary>Modify software cache details</summary> /// <param name="clientId">Software cache client id</param> /// <param name="body">Request to update software cache properties like associations, cache directory or enabled for a specific /// server.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateSoftwareCacheDetailsWithResult(long clientId, Commvault.Powershell.Models.IModifySoftwareCacheDetails body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/SoftwareCache/" + (clientId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateSoftwareCacheDetailsWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateSoftwareCacheDetailsWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateSoftwareCacheDetailsWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateSoftwareCacheDetails" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateSoftwareCacheDetails_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateSoftwareCacheDetails" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="clientId">Software cache client id</param> /// <param name="body">Request to update software cache properties like associations, cache directory or enabled for a specific /// server.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateSoftwareCacheDetails_Validate(long clientId, Commvault.Powershell.Models.IModifySoftwareCacheDetails body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Add, Modify and Delete notes for triggered alerts</summary> /// <param name="id"></param> /// <param name="body">UpdateTriggeredAlertsNotes</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateTriggeredAlertsNotes(long id, Commvault.Powershell.Models.IUpdateTriggeredAlertsNotes body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + (id.ToString()) + "/Notes" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateTriggeredAlertsNotes_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Add, Modify and Delete notes for triggered alerts</summary> /// <param name="viaIdentity"></param> /// <param name="body">UpdateTriggeredAlertsNotes</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateTriggeredAlertsNotesViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateTriggeredAlertsNotes body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/TriggeredAlerts/(?<id>[^/]+)/Notes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/TriggeredAlerts/{id}/Notes'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + id + "/Notes" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateTriggeredAlertsNotes_Call (request, onOk,onInternalServerError,eventListener,sender); } } /// <summary>Add, Modify and Delete notes for triggered alerts</summary> /// <param name="viaIdentity"></param> /// <param name="body">UpdateTriggeredAlertsNotes</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateTriggeredAlertsNotesViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateTriggeredAlertsNotes body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/TriggeredAlerts/(?<id>[^/]+)/Notes$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/TriggeredAlerts/{id}/Notes'"); } // replace URI parameters with values from identity var id = _match.Groups["id"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + id + "/Notes" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateTriggeredAlertsNotesWithResult_Call (request, eventListener,sender); } } /// <summary>Add, Modify and Delete notes for triggered alerts</summary> /// <param name="id"></param> /// <param name="body">UpdateTriggeredAlertsNotes</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateTriggeredAlertsNotesWithResult(long id, Commvault.Powershell.Models.IUpdateTriggeredAlertsNotes body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/TriggeredAlerts/" + (id.ToString()) + "/Notes" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateTriggeredAlertsNotesWithResult_Call (request, eventListener,sender); } } /// <summary> /// Actual wire call for <see cref= "UpdateTriggeredAlertsNotesWithResult" /> method. /// </summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateTriggeredAlertsNotesWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateTriggeredAlertsNotes" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateTriggeredAlertsNotes_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateTriggeredAlertsNotes" /> method. Call this like the actual call, but you will get /// validation events back. /// </summary> /// <param name="id"></param> /// <param name="body">UpdateTriggeredAlertsNotes</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateTriggeredAlertsNotes_Validate(long id, Commvault.Powershell.Models.IUpdateTriggeredAlertsNotes body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to modify an existing user</summary> /// <param name="userId">Id of the User to update</param> /// <param name="body">Used to update an existing user.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateUser(long userId, Commvault.Powershell.Models.IUpdateUser body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + (userId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateUser_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing user-group</summary> /// <param name="userGroupId">Id of the user-group to update</param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateUserGroup(long userGroupId, Commvault.Powershell.Models.IUpdateUserGroup body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup/" + (userGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateUserGroup_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing user-group</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateUserGroupViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateUserGroup body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/UserGroup/(?<userGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/UserGroup/{userGroupId}'"); } // replace URI parameters with values from identity var userGroupId = _match.Groups["userGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup/" + userGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateUserGroup_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing user-group</summary> /// <param name="viaIdentity"></param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateUserGroupViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateUserGroup body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/UserGroup/(?<userGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/UserGroup/{userGroupId}'"); } // replace URI parameters with values from identity var userGroupId = _match.Groups["userGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup/" + userGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateUserGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Modify the properties of an existing user-group</summary> /// <param name="userGroupId">Id of the user-group to update</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateUserGroupWithResult(long userGroupId, Commvault.Powershell.Models.IUpdateUserGroup body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UserGroup/" + (userGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateUserGroupWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateUserGroupWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateUserGroupWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateUserGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateUserGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateUserGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="userGroupId">Id of the user-group to update</param> /// <param name="body"></param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateUserGroup_Validate(long userGroupId, Commvault.Powershell.Models.IUpdateUserGroup body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Used to modify an existing user</summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to update an existing user.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateUserViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateUser body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/user/(?<userId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/user/{userId}'"); } // replace URI parameters with values from identity var userId = _match.Groups["userId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + userId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateUser_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Used to modify an existing user</summary> /// <param name="viaIdentity"></param> /// <param name="body">Used to update an existing user.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateUserViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateUser body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/user/(?<userId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/user/{userId}'"); } // replace URI parameters with values from identity var userId = _match.Groups["userId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + userId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateUserWithResult_Call (request, eventListener,sender); } } /// <summary>Used to modify an existing user</summary> /// <param name="userId">Id of the User to update</param> /// <param name="body">Used to update an existing user.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateUserWithResult(long userId, Commvault.Powershell.Models.IUpdateUser body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/user/" + (userId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateUserWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateUserWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateUserWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateUser" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateUser_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateUser" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="userId">Id of the User to update</param> /// <param name="body">Used to update an existing user.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateUser_Validate(long userId, Commvault.Powershell.Models.IUpdateUser body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify the properties of an existing Blackout Window</summary> /// <param name="blackoutWindowId">Id of the Blackout Window to update</param> /// <param name="body">company-refers to company to which the blackout window is associated.Dates have to be provided in unix /// time format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateV4BlackoutWindow(long blackoutWindowId, Commvault.Powershell.Models.IV4UpdateBlackoutWindow body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow/" + (blackoutWindowId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateV4BlackoutWindow_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing Blackout Window</summary> /// <param name="viaIdentity"></param> /// <param name="body">company-refers to company to which the blackout window is associated.Dates have to be provided in unix /// time format.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateV4BlackoutWindowViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IV4UpdateBlackoutWindow body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/BlackoutWindow/(?<blackoutWindowId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/BlackoutWindow/{blackoutWindowId}'"); } // replace URI parameters with values from identity var blackoutWindowId = _match.Groups["blackoutWindowId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow/" + blackoutWindowId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateV4BlackoutWindow_Call (request, onOk,onBadRequest,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing Blackout Window</summary> /// <param name="viaIdentity"></param> /// <param name="body">company-refers to company to which the blackout window is associated.Dates have to be provided in unix /// time format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateV4BlackoutWindowViaIdentityWithResult(global::System.String viaIdentity, Commvault.Powershell.Models.IV4UpdateBlackoutWindow body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/BlackoutWindow/(?<blackoutWindowId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/BlackoutWindow/{blackoutWindowId}'"); } // replace URI parameters with values from identity var blackoutWindowId = _match.Groups["blackoutWindowId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow/" + blackoutWindowId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateV4BlackoutWindowWithResult_Call (request, eventListener,sender); } } /// <summary>Modify the properties of an existing Blackout Window</summary> /// <param name="blackoutWindowId">Id of the Blackout Window to update</param> /// <param name="body">company-refers to company to which the blackout window is associated.Dates have to be provided in unix /// time format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateV4BlackoutWindowWithResult(long blackoutWindowId, Commvault.Powershell.Models.IV4UpdateBlackoutWindow body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/BlackoutWindow/" + (blackoutWindowId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpdateV4BlackoutWindowWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateV4BlackoutWindowWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>" /> that will be complete when /// handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp> UpdateV4BlackoutWindowWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpdateV4BlackoutWindow" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateV4BlackoutWindow_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateV4BlackoutWindow" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="blackoutWindowId">Id of the Blackout Window to update</param> /// <param name="body">company-refers to company to which the blackout window is associated.Dates have to be provided in unix /// time format.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateV4BlackoutWindow_Validate(long blackoutWindowId, Commvault.Powershell.Models.IV4UpdateBlackoutWindow body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Update the VM Group</summary> /// <param name="vmGroupId">Id of the VMgroup to update</param> /// <param name="body">UpdatevmGroupReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateVMGroup(long vmGroupId, Commvault.Powershell.Models.IUpdatevmGroupReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VmGroup/" + (vmGroupId.ToString()) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateVMGroup_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Update the VM Group</summary> /// <param name="viaIdentity"></param> /// <param name="body">UpdatevmGroupReq</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateVMGroupViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdatevmGroupReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VmGroup/(?<VmGroupId>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VmGroup/{VmGroupId}'"); } // replace URI parameters with values from identity var vmGroupId = _match.Groups["VmGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VmGroup/" + vmGroupId ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateVMGroup_Call (request, onOk,onBadRequest,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateVMGroup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateVMGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericRespWithWarning>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericRespWithWarning.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateVMGroup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="vmGroupId">Id of the VMgroup to update</param> /// <param name="body">UpdatevmGroupReq</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateVMGroup_Validate(long vmGroupId, Commvault.Powershell.Models.IUpdatevmGroupReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Modify the properties of an existing virtual machine</summary> /// <param name="vmUuid">The vmUUID can be obtained from GET /virtualMachines UUID property</param> /// <param name="body">UpdateVMProperties</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateVirtualMachine(string vmUuid, Commvault.Powershell.Models.IUpdateVMProperties body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onUnauthorized, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VirtualMachines/" + global::System.Uri.EscapeDataString(vmUuid) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateVirtualMachine_Call (request, onOk,onUnauthorized,onNotFound,eventListener,sender); } } /// <summary>Modify the properties of an existing virtual machine</summary> /// <param name="viaIdentity"></param> /// <param name="body">UpdateVMProperties</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpdateVirtualMachineViaIdentity(global::System.String viaIdentity, Commvault.Powershell.Models.IUpdateVMProperties body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onUnauthorized, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VirtualMachines/(?<vmUUID>[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VirtualMachines/{vmUUID}'"); } // replace URI parameters with values from identity var vmUuid = _match.Groups["vmUUID"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VirtualMachines/" + vmUuid ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpdateVirtualMachine_Call (request, onOk,onUnauthorized,onNotFound,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpdateVirtualMachine" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onUnauthorized">a delegate that is called when the remote service returns 401 (Unauthorized).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateVirtualMachine_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onUnauthorized, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task> onNotFound, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response); break; } case global::System.Net.HttpStatusCode.Unauthorized: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onUnauthorized(_response); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpdateVirtualMachine" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="vmUuid">The vmUUID can be obtained from GET /virtualMachines UUID property</param> /// <param name="body">UpdateVMProperties</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpdateVirtualMachine_Validate(string vmUuid, Commvault.Powershell.Models.IUpdateVMProperties body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(vmUuid),vmUuid); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Upgrade software for client and client group.</summary> /// <param name="body">Request body for server and server group upgrade software</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task UpgradeSoftware(Commvault.Powershell.Models.IUpgradeSoftware body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UpgradeSoftware" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.UpgradeSoftware_Call (request, onOk,eventListener,sender); } } /// <summary>Upgrade software for client and client group.</summary> /// <param name="body">Request body for server and server group upgrade software</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse> UpgradeSoftwareWithResult(Commvault.Powershell.Models.IUpgradeSoftware body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/UpgradeSoftware" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Put, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.UpgradeSoftwareWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "UpgradeSoftwareWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse> UpgradeSoftwareWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.JobIdResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "UpgradeSoftware" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpgradeSoftware_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IJobIdResponse>, global::System.Threading.Tasks.Task> onOk, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.JobIdResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="UpgradeSoftware" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Request body for server and server group upgrade software</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task UpgradeSoftware_Validate(Commvault.Powershell.Models.IUpgradeSoftware body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>Perform VaultTracker Operations</summary> /// <param name="body">Payload for VaultTracker Operation</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task VaultTrackerOperation(Commvault.Powershell.Models.IVaultTrackerOperationReq body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VaultTrackerAction/Operation" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.VaultTrackerOperation_Call (request, onOk,onBadRequest,onForbidden,onInternalServerError,eventListener,sender); } } /// <summary>Perform VaultTracker Operations</summary> /// <param name="body">Payload for VaultTracker Operation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> VaultTrackerOperationWithResult(Commvault.Powershell.Models.IVaultTrackerOperationReq body, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VaultTrackerAction/Operation" ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return null; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return null; } // make the call return await this.VaultTrackerOperationWithResult_Call (request, eventListener,sender); } } /// <summary>Actual wire call for <see cref= "VaultTrackerOperationWithResult" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>" /> that will be complete /// when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse> VaultTrackerOperationWithResult_Call(global::System.Net.Http.HttpRequestMessage request, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return null; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return null; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return null; } var _result = _response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) ); return await _result; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary>Actual wire call for <see cref= "VaultTrackerOperation" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onBadRequest">a delegate that is called when the remote service returns 400 (BadRequest).</param> /// <param name="onForbidden">a delegate that is called when the remote service returns 403 (Forbidden).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task VaultTrackerOperation_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onBadRequest, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onForbidden, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResponse>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.BadRequest: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onBadRequest(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.Forbidden: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onForbidden(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResponse.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="VaultTrackerOperation" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="body">Payload for VaultTracker Operation</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task VaultTrackerOperation_Validate(Commvault.Powershell.Models.IVaultTrackerOperationReq body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>To Backup the virtual machines in vmgroup</summary> /// <param name="vmUuid">Id of the Virtual Machine to backup</param> /// <param name="backupLevel">Backup level , Default :Incremental</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task VirtualMachineBackup(string vmUuid, string backupLevel, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VirtualMachines/" + global::System.Uri.EscapeDataString(vmUuid) + "/backup" + "?" + (string.IsNullOrEmpty(backupLevel) ? global::System.String.Empty : "backupLevel=" + global::System.Uri.EscapeDataString(backupLevel)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.VirtualMachineBackup_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>To Backup the virtual machines in vmgroup</summary> /// <param name="viaIdentity"></param> /// <param name="backupLevel">Backup level , Default :Incremental</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task VirtualMachineBackupViaIdentity(global::System.String viaIdentity, string backupLevel, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VirtualMachines/(?<vmUUID>[^/]+)/backup$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VirtualMachines/{vmUUID}/backup'"); } // replace URI parameters with values from identity var vmUuid = _match.Groups["vmUUID"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VirtualMachines/" + vmUuid + "/backup" + "?" + (string.IsNullOrEmpty(backupLevel) ? global::System.String.Empty : "backupLevel=" + global::System.Uri.EscapeDataString(backupLevel)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.VirtualMachineBackup_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "VirtualMachineBackup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task VirtualMachineBackup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="VirtualMachineBackup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="vmUuid">Id of the Virtual Machine to backup</param> /// <param name="backupLevel">Backup level , Default :Incremental</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task VirtualMachineBackup_Validate(string vmUuid, string backupLevel, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(vmUuid),vmUuid); await eventListener.AssertNotNull(nameof(backupLevel),backupLevel); } } /// <summary>To Backup the virtual machines in vmgroup</summary> /// <param name="vmGroupId">Id of the VMgroup to backup</param> /// <param name="backupLevel">Backup level , Default :Incremental</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task VmgroupBackup(long vmGroupId, string backupLevel, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VmGroup/" + (vmGroupId.ToString()) + "/backup" + "?" + (string.IsNullOrEmpty(backupLevel) ? global::System.String.Empty : "backupLevel=" + global::System.Uri.EscapeDataString(backupLevel)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.VmgroupBackup_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>To Backup the virtual machines in vmgroup</summary> /// <param name="viaIdentity"></param> /// <param name="backupLevel">Backup level , Default :Incremental</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task VmgroupBackupViaIdentity(global::System.String viaIdentity, string backupLevel, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VmGroup/(?<VmGroupId>[^/]+)/backup$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VmGroup/{VmGroupId}/backup'"); } // replace URI parameters with values from identity var vmGroupId = _match.Groups["VmGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VmGroup/" + vmGroupId + "/backup" + "?" + (string.IsNullOrEmpty(backupLevel) ? global::System.String.Empty : "backupLevel=" + global::System.Uri.EscapeDataString(backupLevel)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.VmgroupBackup_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "VmgroupBackup" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task VmgroupBackup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="VmgroupBackup" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="vmGroupId">Id of the VMgroup to backup</param> /// <param name="backupLevel">Backup level , Default :Incremental</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task VmgroupBackup_Validate(long vmGroupId, string backupLevel, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(backupLevel),backupLevel); } } /// <summary>To restore the virtual machines in vmgroup</summary> /// <param name="vmGroupId">Id of the VMgroup to backup</param> /// <param name="mediaAgentName">Media agent name</param> /// <param name="mediaAgentId">Media agent id</param> /// <param name="fromTime">Restore window UTC from time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd</param> /// <param name="toTime">Restore window UTC to time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd</param> /// <param name="body">VM or VMGroup restore request body</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task VmgroupRestore(long vmGroupId, string mediaAgentName, string mediaAgentId, string fromTime, global::System.DateTime? toTime, Commvault.Powershell.Models.IVMGroupRestoreRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VmGroup/" + (vmGroupId.ToString()) + "/restore" + "?" + (string.IsNullOrEmpty(mediaAgentName) ? global::System.String.Empty : "mediaAgentName=" + global::System.Uri.EscapeDataString(mediaAgentName)) + "&" + (string.IsNullOrEmpty(mediaAgentId) ? global::System.String.Empty : "mediaAgentId=" + global::System.Uri.EscapeDataString(mediaAgentId)) + "&" + (string.IsNullOrEmpty(fromTime) ? global::System.String.Empty : "fromTime=" + global::System.Uri.EscapeDataString(fromTime)) + "&" + (null == toTime ? global::System.String.Empty : "toTime=" + toTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.VmgroupRestore_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>To restore the virtual machines in vmgroup</summary> /// <param name="viaIdentity"></param> /// <param name="mediaAgentName">Media agent name</param> /// <param name="mediaAgentId">Media agent id</param> /// <param name="fromTime">Restore window UTC from time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd</param> /// <param name="toTime">Restore window UTC to time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd</param> /// <param name="body">VM or VMGroup restore request body</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task VmgroupRestoreViaIdentity(global::System.String viaIdentity, string mediaAgentName, string mediaAgentId, string fromTime, global::System.DateTime? toTime, Commvault.Powershell.Models.IVMGroupRestoreRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VmGroup/(?<VmGroupId>[^/]+)/restore$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VmGroup/{VmGroupId}/restore'"); } // replace URI parameters with values from identity var vmGroupId = _match.Groups["VmGroupId"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VmGroup/" + vmGroupId + "/restore" + "?" + (string.IsNullOrEmpty(mediaAgentName) ? global::System.String.Empty : "mediaAgentName=" + global::System.Uri.EscapeDataString(mediaAgentName)) + "&" + (string.IsNullOrEmpty(mediaAgentId) ? global::System.String.Empty : "mediaAgentId=" + global::System.Uri.EscapeDataString(mediaAgentId)) + "&" + (string.IsNullOrEmpty(fromTime) ? global::System.String.Empty : "fromTime=" + global::System.Uri.EscapeDataString(fromTime)) + "&" + (null == toTime ? global::System.String.Empty : "toTime=" + toTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.VmgroupRestore_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "VmgroupRestore" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task VmgroupRestore_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="VmgroupRestore" /> method. Call this like the actual call, but you will get validation /// events back. /// </summary> /// <param name="vmGroupId">Id of the VMgroup to backup</param> /// <param name="mediaAgentName">Media agent name</param> /// <param name="mediaAgentId">Media agent id</param> /// <param name="fromTime">Restore window UTC from time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd</param> /// <param name="toTime">Restore window UTC to time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd</param> /// <param name="body">VM or VMGroup restore request body</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task VmgroupRestore_Validate(long vmGroupId, string mediaAgentName, string mediaAgentId, string fromTime, global::System.DateTime? toTime, Commvault.Powershell.Models.IVMGroupRestoreRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(mediaAgentName),mediaAgentName); await eventListener.AssertNotNull(nameof(mediaAgentId),mediaAgentId); await eventListener.AssertNotNull(nameof(fromTime),fromTime); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } /// <summary>To restore a virtual machine</summary> /// <param name="vmGuid"></param> /// <param name="mediaAgentName">Media agent name</param> /// <param name="mediaAgentId">Media agent id</param> /// <param name="fromTime">Restore window UTC from time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd</param> /// <param name="toTime">Restore window UTC to time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd</param> /// <param name="body">VM or VMGroup restore request body</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task Vmrestore(string vmGuid, string mediaAgentName, string mediaAgentId, string fromTime, global::System.DateTime? toTime, Commvault.Powershell.Models.IVMGroupRestoreRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + global::System.Uri.EscapeDataString(vmGuid) + "/restore" + "?" + (string.IsNullOrEmpty(mediaAgentName) ? global::System.String.Empty : "mediaAgentName=" + global::System.Uri.EscapeDataString(mediaAgentName)) + "&" + (string.IsNullOrEmpty(mediaAgentId) ? global::System.String.Empty : "mediaAgentId=" + global::System.Uri.EscapeDataString(mediaAgentId)) + "&" + (string.IsNullOrEmpty(fromTime) ? global::System.String.Empty : "fromTime=" + global::System.Uri.EscapeDataString(fromTime)) + "&" + (null == toTime ? global::System.String.Empty : "toTime=" + toTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.Vmrestore_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>To restore a virtual machine</summary> /// <param name="viaIdentity"></param> /// <param name="mediaAgentName">Media agent name</param> /// <param name="mediaAgentId">Media agent id</param> /// <param name="fromTime">Restore window UTC from time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd</param> /// <param name="toTime">Restore window UTC to time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd</param> /// <param name="body">VM or VMGroup restore request body</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <param name="serializationMode">Allows the caller to choose the depth of the serialization. See <see cref="Commvault.Powershell.Runtime.SerializationMode"/>.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> public async global::System.Threading.Tasks.Task VmrestoreViaIdentity(global::System.String viaIdentity, string mediaAgentName, string mediaAgentId, string fromTime, global::System.DateTime? toTime, Commvault.Powershell.Models.IVMGroupRestoreRequest body, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender, Commvault.Powershell.Runtime.SerializationMode serializationMode = Commvault.Powershell.Runtime.SerializationMode.IncludeCreate|Commvault.Powershell.Runtime.SerializationMode.IncludeUpdate) { // Constant Parameters using( NoSynchronizationContext ) { // verify that Identity format is an exact match for uri var _match = new global::System.Text.RegularExpressions.Regex("^/V4/VM/(?<vmGuid>[^/]+)/restore$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); if (!_match.Success) { throw new global::System.Exception("Invalid identity for URI '/V4/VM/{vmGuid}/restore'"); } // replace URI parameters with values from identity var vmGuid = _match.Groups["vmGuid"].Value; // construct URL var pathAndQuery = global::System.Text.RegularExpressions.Regex.Replace( "/V4/VM/" + vmGuid + "/restore" + "?" + (string.IsNullOrEmpty(mediaAgentName) ? global::System.String.Empty : "mediaAgentName=" + global::System.Uri.EscapeDataString(mediaAgentName)) + "&" + (string.IsNullOrEmpty(mediaAgentId) ? global::System.String.Empty : "mediaAgentId=" + global::System.Uri.EscapeDataString(mediaAgentId)) + "&" + (string.IsNullOrEmpty(fromTime) ? global::System.String.Empty : "fromTime=" + global::System.Uri.EscapeDataString(fromTime)) + "&" + (null == toTime ? global::System.String.Empty : "toTime=" + toTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.URLCreated, pathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } // generate request object var _url = new global::System.Uri($"http://WebserverUrl.Commvault.com/webconsole/api{pathAndQuery}"); var request = new global::System.Net.Http.HttpRequestMessage(Commvault.Powershell.Runtime.Method.Post, _url); await eventListener.Signal(Commvault.Powershell.Runtime.Events.RequestCreated, request.RequestUri.PathAndQuery); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.HeaderParametersAdded); if( eventListener.Token.IsCancellationRequested ) { return; } // set body content request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null, serializationMode).ToString() : @"{}", global::System.Text.Encoding.UTF8); request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BodyContentSet); if( eventListener.Token.IsCancellationRequested ) { return; } // make the call await this.Vmrestore_Call (request, onOk,onNotFound,onInternalServerError,eventListener,sender); } } /// <summary>Actual wire call for <see cref= "Vmrestore" /> method.</summary> /// <param name="request">the prepared HttpRequestMessage to send.</param> /// <param name="onOk">a delegate that is called when the remote service returns 200 (OK).</param> /// <param name="onNotFound">a delegate that is called when the remote service returns 404 (NotFound).</param> /// <param name="onInternalServerError">a delegate that is called when the remote service returns 500 (InternalServerError).</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <param name="sender">an instance of an Commvault.Powershell.Runtime.ISendAsync pipeline to use to make the request.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task Vmrestore_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.ICreateTaskRespforBackup>, global::System.Threading.Tasks.Task> onOk, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onNotFound, global::System.Func<global::System.Net.Http.HttpResponseMessage, global::System.Threading.Tasks.Task<Commvault.Powershell.Models.IGenericResp>, global::System.Threading.Tasks.Task> onInternalServerError, Commvault.Powershell.Runtime.IEventListener eventListener, Commvault.Powershell.Runtime.ISendAsync sender) { using( NoSynchronizationContext ) { global::System.Net.Http.HttpResponseMessage _response = null; try { var sendTask = sender.SendAsync(request, eventListener); await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } _response = await sendTask; await eventListener.Signal(Commvault.Powershell.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await eventListener.Signal(Commvault.Powershell.Runtime.Events.Progress, "intentional placeholder", 100); if( eventListener.Token.IsCancellationRequested ) { return; } var _contentType = _response.Content.Headers.ContentType?.MediaType; switch ( _response.StatusCode ) { case global::System.Net.HttpStatusCode.OK: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.CreateTaskRespforBackup.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.NotFound: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onNotFound(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } case global::System.Net.HttpStatusCode.InternalServerError: { await eventListener.Signal(Commvault.Powershell.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } await onInternalServerError(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Commvault.Powershell.Models.GenericResp.FromJson(Commvault.Powershell.Runtime.Json.JsonNode.Parse(body.Result)) )); break; } default: { throw new Commvault.Powershell.Runtime.UndeclaredResponseException(_response); } } } finally { // finally statements await eventListener.Signal(Commvault.Powershell.Runtime.Events.Finally, request, _response); _response?.Dispose(); request?.Dispose(); } } } /// <summary> /// Validation method for <see cref="Vmrestore" /> method. Call this like the actual call, but you will get validation events /// back. /// </summary> /// <param name="vmGuid"></param> /// <param name="mediaAgentName">Media agent name</param> /// <param name="mediaAgentId">Media agent id</param> /// <param name="fromTime">Restore window UTC from time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd</param> /// <param name="toTime">Restore window UTC to time. Valid Formats: yyyy-MM-ddTHH:mm:ss or yyyy-MM-ddTHH:mm:sszzz or yyyy-MM-dd</param> /// <param name="body">VM or VMGroup restore request body</param> /// <param name="eventListener">an <see cref="Commvault.Powershell.Runtime.IEventListener" /> instance that will receive events.</param> /// <returns> /// A <see cref="global::System.Threading.Tasks.Task" /> that will be complete when handling of the response is completed. /// </returns> internal async global::System.Threading.Tasks.Task Vmrestore_Validate(string vmGuid, string mediaAgentName, string mediaAgentId, string fromTime, global::System.DateTime? toTime, Commvault.Powershell.Models.IVMGroupRestoreRequest body, Commvault.Powershell.Runtime.IEventListener eventListener) { using( NoSynchronizationContext ) { await eventListener.AssertNotNull(nameof(vmGuid),vmGuid); await eventListener.AssertNotNull(nameof(mediaAgentName),mediaAgentName); await eventListener.AssertNotNull(nameof(mediaAgentId),mediaAgentId); await eventListener.AssertNotNull(nameof(fromTime),fromTime); await eventListener.AssertNotNull(nameof(body), body); await eventListener.AssertObjectIsValid(nameof(body), body); } } } } |